I. J. Kennedy
I. J. Kennedy

Reputation: 25849

Why isn't the Documents function defined in my client.query object in FaunaDB?

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>

Upvotes: 0

Views: 178

Answers (1)

Marrony
Marrony

Reputation: 231

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

Upvotes: 1

Related Questions