Do GraphQL Pagnation in reverse

How would I do graphql pagnation function in reverse, getting items from most recently added to least recently added, instead of the other way around?

Hi @MalekiRe and welcome!

This is not possible out of the box. Please see this existing forums post: How to sort GraphQL query results

There are also open feature requests that would support sorted results. Please feel free to comment on it, and don’t forget to vote for feature requests that are important to you!

Since your question is about reversing the order in particular, I’ll note that this is accomplished by providing the reverse property to Index values, which is why supporting Indexes which define values is required. See the docs for sorted Indexes: Sort with indexes | Fauna Documentation

ex:

CreateIndex({
  name: "people_sort_by_first_desc",
  source: Collection("People"),
  values: [
    { field: ["data", "first"], reverse: true }, // <-- reverse property
    { field: ["ref"] }
  ]
})

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.