Skip to content

Commit

Permalink
docs: nested sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
saihaj committed Mar 9, 2023
1 parent 310d102 commit 86605a1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions website/pages/en/querying/graphql-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ When querying a collection, the `orderBy` parameter may be used to sort by a spe
}
```

#### Example for nested entity sorting

Sorting on the basis of nested entities is useful if you are looking to sort entities based on child fields.

In the following example, we sort the tokens by the name of their owner:

```graphql
{
tokens(orderBy: owner__name, orderDirection: asc) {
id
owner {
name
}
}
}
```

### Pagination

When querying a collection, the `first` parameter can be used to paginate from the beginning of the collection. It is worth noting that the default sort order is by ID in ascending alphanumeric order, not by creation time.
Expand Down

0 comments on commit 86605a1

Please sign in to comment.