Example
Sometimes you don't want to receive all results at once, so you need to filter them. To do so, let's look at this example:
query{
Suppliers (id__Gt:100) {
edges{
node{
label
}
}
}
}
Here we only request suppliers who's ids are greater than 100. You can change the value to suit your needs.
All filters
Each filter follows the same structure: field__Operation with field being a field available for the entity (this field doesn't have to be requested in the query), two underscores __ as separation, then the operation. You then pass the value you want the use as filter.
Here are all the available operations you can use to filter results:
Operation | SQL Operation | Cardinality | Syntax |
---|---|---|---|
In | IN | Singular or plural | For ease of use, you can skip using the In operator and simply put the field's name, like this: id : 1 or id : [1,2,3] |
NotIn | NOT IN | Singular or plural | id__NotIn : 1 or id__NotIn : [1,2,3] |
Lt | < | Singular | id__Lt : 40 |
Le | <= | Singular | subtotal__Le : 50000 |
Gt | > | Singular | shipping_cost__Gt : 10.3 |
Ge | >= | Singular | total_tax_amount__Ge : 1 |
Between | x<=y<=z | Singular | discount__Between[2,6] |
Like | LIKE | Singular | label__Like : "Car" |
NotLike | NOT LIKE | Singular | email__NotLike : "John" |
StartWith | LIKE | Singular | first_name__StartWith : "Pat" |
ContainsAll | The result contains all given arguments | Plural | tag_ids__ContainsAll:["blue", "green"] |