Skip to main content

Sorting

To sort our results we can make use of the orderBy parameter, which takes as a value an array of the corresponding Order types. These types are defined as:

type ExampleOrder {
field: ExampleOrderField!
direction: OrderDirection!
}

Where ExampleOrderField is the group (an enum) of available fields to sort a particular entity, and OrderDirection is defined as follows:

enum OrderDirection {
ASC
DESC
}

For example, for Project it would be:

type ProjectOrder {
field: ProjectOrderField!
direction: OrderDirection!
}
query getProjects {
me {
accounts(first: 1) {
nodes {
projects(
first: 3
orderBy: [
{ field: name, direction: ASC }
{ field: maxLinks, direction: DESC }
]
) {
nodes {
name
maxLinks
}
}
}
}
}
}

Try in explorer