Filtering
Filtering in query-graphql
has has an object based syntax
For a full reference of filter operations see filter reference
The following example filters for all todoItems that are marked completed.
- GraphQL
- Response
{
todoItems(filter: {completed: {is: true}}){
pageInfo{
hasNextPage
hasPreviousPage
startCursor
endCursor
}
edges{
node{
id
title
completed
created
updated
}
cursor
}
}
}
{
"data": {
"todoItems": {
"pageInfo": {
"hasNextPage": false,
"hasPreviousPage": false,
"startCursor": "YXJyYXljb25uZWN0aW9uOjA=",
"endCursor": "YXJyYXljb25uZWN0aW9uOjE="
},
"edges": [
{
"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": "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="
}
]
}
}
}
Setting the generated filter-type depth
When querying the default filter is one level deep. You can specify the generated filter-type depth by using the QueryOptions decorator on your DTO.
You can find the documentation and an example in the QueryOptions reference.
Setting a default filter
When querying the default filter is empty. You can specify a default filter by using the QueryOptions decorator on your DTO.
You can find the documentation and an example in the QueryOptions reference.
Setting allowed boolean expressions
When filtering you can provide and and or expressions to provide advanced filtering. You can turn off either by using the QueryOptions decorator on your DTO.
You can find the documentation and an example in the QueryOptions reference.