I just want to query an entire collection
- doesnt’ have to be sorted
- doesn’t have to be filtered
- no parameters
- no authorization
- just get first 50 or so objects
do I need to create a UDF or index in order to query?
I just want to query an entire collection
do I need to create a UDF or index in order to query?
You do need an Index, but for GraphQL, you can update your schema with an additional Query
field, and it will create an index for you.
With FQL you would also use an Index. Fauna provides a built-in Index by using the
Documents
function.
Add an “all documents” Query to your GraphQL schema using the @index
directive. Importing the schema will create an index for you.
For example:
type Query {
allThings: [Thing]! @index
}
If you provide a Query
field with no directives, then Fauna defaults to using the @index
functionality. That means that the above example can be shortened to just:
type Query {
allThings: [Thing]!
}
Note that there is nothing special about the name I gave to the field. Here is an earlier forums discussion about how fauna uses the GraphQL schema to generate Indexes:
And some further discussion in the docs:
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.