Use/select database for queries

I have a client key that seems to be working. I set up a collection and some data in a new database using the Fauna Dashboard. But my queries can’t find the collection, I think I should specify that I’m trying to use this database. If I just write client.query(q.Database(databaseId)) it finds the database. I haven’t found any doc as yet on composing q.Database with q.Collection or q.Match.

Im not from Fauna But,

I think you can query all the documents in a collection with an index like so

client.query(
  q.Get(
    q.Match(q.Index('index_name'))
  )
)
.then((ret) => console.log(ret))

you can create a index and choose the colleciton and if you leave all the paramters blank I think it just returns all teh documents

And I think you can also do this

client.query( q.Paginate(q.Documents(q.Collection('Letters')), { size: 3 }), )

and probably dont have to pass the size either

1 Like

I created the collection under a different, existing database. I think it’s associated with the client key, somehow, so that all queries are within the scope of the given database. Perhaps creating a new and different database is not very typical. Anyhow it’s working :white_check_mark: