Filtering Query Results

TinaCMS automatically creates filters for collections defined in your schema.

To filter collection results, pass the filter argument to the <collection>Connection query, followed by any of the filter operator types for the fields on your collection.

The filter object is a nested set of conditions where the keys correspond to the collection field and the value describes the condition.

Conditions can be either "binary" or "ternary". A binary condition is composed of a single operator and a single operand (i.e. {"eq":"foo"}). A ternary condition is composed of two operators and two operands (.i.e. {"gt":0, "lte": 10}).

Operator types

eq
string, number, boolean

Equals


in
string[], number[], boolean[]

One of


gt
string, number

Greater than


gte
string, number

Greater than or equal to


lt
string, number

Less than


lte
string, number

Less than or equal to


startsโ€‹With
string

Starts with


after
datetime

After


before
datetime

Before

Only gt, gte, lt, lte, after, before may be used in ternary conditions.

Examples

Filtering on a field

Here we will query our post collection with postConnection and filter the results by the post title:

Filtering on a field with the IN operator

Here we will query our post collection with postConnection and filter the results so that only members of the specified category are returned:

Filtering on a date range

Here we will query our post collection with postConnection and filter the results so that only posts with a date between the specified range are returned:

Filtering on multiple fields

It is possible to filter on multiple fields. Multiple conditions are currently treated as a boolean AND operation. Here we will query our post collection with postConnection and filter the results by category and title:

Filtering on a reference

Here we will query our post collection with postConnection, and filtering on the referenced author's name:

Last Edited: March 26, 2025