Skip to main content
Version: v2.x

Postgres: Filter Using Boolean Expressions

Filter based on failure of some criteria (_not)

The _not operator can be used to fetch results for which some condition does not hold true. i.e. to invert the filter set for a condition.

Example: _not

Fetch all authors who don't have any published articles:

GraphiQL
Query Variables
Request Headers
Documentation Explorer
No Schema Available

Using multiple filters in the same query (_and, _or)

You can group multiple parameters in the same where argument using the _and or the _or operators to filter results based on more than one criteria.

Note

You can use the _or and _and operators along with the _not operator to create arbitrarily complex boolean expressions involving multiple filtering criteria.

Example: _and

Fetch a list of articles published in a specific time-frame (for example: in year 2017):

GraphiQL
Query Variables
Request Headers
Documentation Explorer
No Schema Available
Note

Certain _and expressions can be expressed in a simpler format using some syntactic sugar. See the API reference for more details.

Example: _or

Fetch a list of articles rated more than 4 or published after "01/01/2018":

GraphiQL
Query Variables
Request Headers
Documentation Explorer
No Schema Available
Note

The _or operator expects an array of expressions as input. If an object is passed as input it will behave like the _and operator as explained in the API reference