Reputation: 640
Considering the given schema declaration:
type Subject @model @key(fields: ["num", "type", "desc", "parent"])
{
id: ID!
num : String!
...
}
How would I call API.graphql
method in order to sort it by its 3rd key, for instance?
Upvotes: 1
Views: 1261
Reputation: 8887
GraphQL doesn't inherently support sorting. To add sorting you need to modify your queries to accept one or more sort parameters and then do the sorting in your code. This article gives examples of Filtering, Pagination & Sorting.
Upvotes: 1