You can filter the query results in GraphQLize using the
Equal To, Not Equal To
Greater Than, Greater Than Or Equal To
Less Than, Less Than Or Equal To
Is Null, Is Not Null
IN, NOT IN
and also supports list of conditions.
The above query can be rewritten as
or is similar to
and in syntax. It accepts both a single condition or a list of conditions.
not operator we can invert the filter condition.
Filter by nested object(s)
We can filter the resulting objects based on the fields of a nested object(s).
One to One
For example, to get all the cities of a county using the country' name in the above schema, We can query it as
One to Many
If the nested object has
one-to-many relationship with its parent, the filter condition yield the results if at-least one of the nested object's field(s) satisfy the condition.
For the above schema, we can get a list of countries which has at-least one city that starts with
Ab using the below query.
Many to Many
A filter based on a nested object with the
many-to-many relationship behaves the same as that of
For the above schema, to get the actors who are part of at-lease one film which has the word
LIFE in its title.
Let's assume that we have a schema like below
To filter authors who has at-least one course with the rating
5, we can achieve it using the following query.
If we want to filter only the authors who has got the rating
5 in all their courses, we can achieve it by
We are making use of SQL anti-join here by inverting the whole condition using
not and complementing the inner condition using its reverse (
neq in the place of
GraphQLize provides a special filter parameter
have to filter based on the existence of child objects. For example, in the above schema, if we'd like to filter only the authors who have courses, it can be achieved using the following query.
Suppose, if we want to filter authors who don't have
courses, we can make use of the
not in addition to
have in the filter.
haveparameter is available only in the
Filtering nested objects
GraphQLize also supports filtering nested objects.