Complex queries
Use the "where" argument to construct complex queries that has multiple conditions and nesting levels. For e.g. to query all car assets manufactured after year 2010:
query {
car (where: {year: {_gt: 2010} }) {
Id
make
color
}
}
Response:
{
"data": {
"car_count": 1,
"car": [
{
"Id": "car1",
"color": "red",
"make": "ford"
}
]
}
}
The query can include multiple conditions and include conditions on nested object fields too. For a complete list of supported operators, refer to Operator
query {
car (where: {
_and: [
{year: {_gt: 2010} },
{engine: {isDefective: {_eq: true}}}
]
}
) {
Id
make
color
}
}
Response:
{
"data": {
"car_count": 1,
"car": [
{
"Id": "car1",
"color": "red",
"make": "ford"
}
]
}
}
Last updated
Was this helpful?