Given this example, https://docs.fauna.com/fauna/current/tutorials/graphql/relations if we had thousands of ToDos, how would one query ToDo’s (and paginate) for a given list?
Default size for a Page
is 50. You can use after
as _cursor
to get more ToDo
s for a given List
Here is an example.
Get First 5 Todos
Get Next set of 5 Todos.
1 Like
This is perfect, and pretty simple. Thanks!
@Jay-Fauna What if I also wanted to use an index to say sort my Todos by something like Title or DueDate?
You should
- Define a resolver.
- Create a sorted Index.
- Update the User Defined Function to use this Index.
- Use Pagination in GraphQL.
Hope this helps.
It does, just a lot more work than anticipating And even then, given the examples it’s still unclear what I’d need to do the sorting and resolver on the sub-collection. I’ll have a play in my spare time this week and see if I can figure it out, otherwise I might just drop using graphql as too complicated to work out at this time and move my code to direct FQL.