sorting parameter.
The sorting parameter is an array where each item has the following options.
field!- The name of the field to sort by.direction!- The direction to sort eitherASCorDESC.nulls?- Optional field to set nulls sort orderNULLS_FIRSTorNULLS_last
- GraphQL
- Response
{
todoItems(sorting: [{ field: title, direction: DESC }]) {
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
edges {
node {
id
title
completed
created
updated
}
cursor
}
}
}
{
"data": {
"todoItems": {
"pageInfo": {
"hasNextPage": false,
"hasPreviousPage": false,
"startCursor": "YXJyYXljb25uZWN0aW9uOjA=",
"endCursor": "YXJyYXljb25uZWN0aW9uOjQ="
},
"edges": [
{
"node": {
"id": "1",
"title": "Create One Todo Item",
"completed": false,
"created": "2020-01-14T07:00:31.763Z",
"updated": "2020-01-14T07:00:31.763Z"
},
"cursor": "YXJyYXljb25uZWN0aW9uOjA="
},
{
"node": {
"id": "5",
"title": "Create Many Todo Items - 4",
"completed": true,
"created": "2020-01-14T07:01:27.805Z",
"updated": "2020-01-14T07:01:27.805Z"
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE="
},
{
"node": {
"id": "4",
"title": "Create Many Todo Items - 3",
"completed": false,
"created": "2020-01-14T07:01:27.805Z",
"updated": "2020-01-14T07:01:27.805Z"
},
"cursor": "YXJyYXljb25uZWN0aW9uOjI="
},
{
"node": {
"id": "3",
"title": "Create Many Todo Items - 2",
"completed": true,
"created": "2020-01-14T07:00:34.111Z",
"updated": "2020-01-14T07:00:34.111Z"
},
"cursor": "YXJyYXljb25uZWN0aW9uOjM="
},
{
"node": {
"id": "2",
"title": "Create Many Todo Items - 1",
"completed": false,
"created": "2020-01-14T07:00:34.111Z",
"updated": "2020-01-14T07:00:34.111Z"
},
"cursor": "YXJyYXljb25uZWN0aW9uOjQ="
}
]
}
}
}
- GraphQL
- Response
{
todoItems(sorting: [{ field: completed, direction: ASC }, { field: title, direction: DESC }]) {
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
edges {
node {
id
title
completed
created
updated
}
cursor
}
}
}
{
"data": {
"todoItems": {
"pageInfo": {
"hasNextPage": false,
"hasPreviousPage": false,
"startCursor": "YXJyYXljb25uZWN0aW9uOjA=",
"endCursor": "YXJyYXljb25uZWN0aW9uOjQ="
},
"edges": [
{
"node": {
"id": "1",
"title": "Create One Todo Item",
"completed": false,
"created": "2020-01-14T07:00:31.763Z",
"updated": "2020-01-14T07:00:31.763Z"
},
"cursor": "YXJyYXljb25uZWN0aW9uOjA="
},
{
"node": {
"id": "4",
"title": "Create Many Todo Items - 3",
"completed": false,
"created": "2020-01-14T07:01:27.805Z",
"updated": "2020-01-14T07:01:27.805Z"
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE="
},
{
"node": {
"id": "2",
"title": "Create Many Todo Items - 1",
"completed": false,
"created": "2020-01-14T07:00:34.111Z",
"updated": "2020-01-14T07:00:34.111Z"
},
"cursor": "YXJyYXljb25uZWN0aW9uOjI="
},
{
"node": {
"id": "5",
"title": "Create Many Todo Items - 4",
"completed": true,
"created": "2020-01-14T07:01:27.805Z",
"updated": "2020-01-14T07:01:27.805Z"
},
"cursor": "YXJyYXljb25uZWN0aW9uOjM="
},
{
"node": {
"id": "3",
"title": "Create Many Todo Items - 2",
"completed": true,
"created": "2020-01-14T07:00:34.111Z",
"updated": "2020-01-14T07:00:34.111Z"
},
"cursor": "YXJyYXljb25uZWN0aW9uOjQ="
}
]
}
}
}