Advanced Querying
It is possible to construct advanced GraphQL queries using the following features.
Comparison Operators
A comparison operator field allows you to define a condition that is more complex than exact equality, such as a range query.
Operator | Description |
---|---|
gt | Finds results where the field is greater than the specified value. |
gte | Finds results where the field is greater than or equal to the specified value. |
lt | Finds results where the field is less than the specified value. |
lte | Finds results where the field is less than or equal to the specified value. |
ne | Finds results where the field is not equal to the specified value. |
in | Finds results where the field is equal to any value in the specified array. |
nin | Finds results where the field is not equal to any value in the specified array. |
exists | Finds documents where the field is not null . |
Logical Operators
A logical operator field allows you to define logical combinations of independent QueryInput
objects.
Operator | Description |
---|---|
AND | Finds documents that match all of the provided QueryInput objects. |
OR | Finds documents that match any of the provided QueryInput objects. |
blocks(
query: {
AND: [
{ protocolState: { consensusState: { epoch: 2 } } }
{ stateHash: "3NK6UJfL6WWvqsdLGdmpYpmmRrdR8oCZsq3AuWdRnH8WcmaFGiRn" }
]
}
)
Sorting
You can sort in ascending and descending order by any root-level field that does not have a type of object
or array.
snarks(
limit: 10
sortBy: FEE_DESC
}
)
Was this page helpful?