0

I am trying to access a Fauna database using the example provided in the documentation. However, in the line marked "ERROR HERE" in the code below, I get an exception TypeError: q.Documents is not a function. I've looked using the Chrome debugger and sure enough Documents is not defined in the client.query object (q).

<script src="//cdn.jsdelivr.net/gh/fauna/faunadb-js-release@latest/faunadb-min.js"></script>
<script>
    var client = new faunadb.Client({
        secret: "fnAD15hPbyACANkT8jKl2Ai0AZJZWYF0q9YXT12M" // not real!
    });

    let q = faunadb.query;
    console.log(q);

    let db = q.Database('grocery_list');
    console.log(db);

    let collection = q.Collection('items');
    console.log(collection);     // this works

    client.query(
        q.Paginate(q.Documents(q.Collection('items')), { size: 2 }),  // <-- ERROR HERE
    )
    .then((ret) => console.log(ret))
</script>

1 Answer 1

1

you are using the wrong CDN link, take a look on instructions in the Github driver page https://github.com/fauna/faunadb-js/#browsers

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.