Skip to Page NavigationSkip to Page NavigationSkip to Content
Keystone 6 is in Community Preview! For Keystone 5 docs visit v5.keystonejs.com

Query Filter API

We recently improved this API so it’s easier to program and reason about. If you were using it prior to August 17th 2021, read this guide for info on how to upgrade.

Each field type provides its own set of filters which can be used with queries. This page lists all the filters available for each field type. For more details on how to use filters in queries please consult to the GraphQL Queries - Filters guide.

Scalar types

checkbox

Filter nameTypeDescription
equalsBooleanEquals
notBooleanNullableFilterDoes not match the inner filter

integer

Filter nameTypeDescription
equalsIntEquals
ltIntLess than
lteIntLess than or equal
gtIntGreater than
gteIntGreater than or equal
in[Int!]Is in the array
notIn[Int!]Is not in the array
notIntNullableFilterDoes not match the inner filter

json

The json field type does not support filters.

float

Filter nameTypeDescription
equalsFloatEquals
ltFloatLess than
lteFloatLess than or equal
gtFloatGreater than
gteFloatGreater than or equal
in[Float!]Is in the array
notIn[Float!]Is not in the array
notFloatNullableFilterDoes not match the inner filter

password

Filter nameTypeDescription
isSetBooleanA value is set

select

  • If the type is string(the default), the same filters as text will be available.
  • If the type is integer, the same filters as integer will be available.
  • If the type is enum, the following filters will be available:
    Filter nameTypeDescription
    equalsListKeyFieldKeyTypeEquals
    in[ListKeyFieldKeyType!]Is in the array
    notIn[ListKeyFieldKeyType!]Is not in the array
    notListKeyFieldKeyTypeNullableFilterDoes not match the inner filter

text

Filter nameTypeDescriptionNotes
equalsStringEquals
ltStringLess than
lteStringLess than or equal
gtStringGreater than
gteStringGreater than or equal
containsStringContains[1]
startsWithStringStarts with[1]
endsWithStringEnds with[1]
in[String!]Is in the array
notIn[String!]Is not in the array
modeQueryMode (default or insensitive)Whether the filters should be case insensitive or not[2]
notNestedStringNullableFilterDoes not match the inner filter

Notes

  • [1] Will follow the setting of the mode on postgresql and will be case insensitive but only for ASCII characters on sqlite
  • [2] postgresql only

timestamp

Filter nameTypeDescription
equalsStringEquals
ltStringLess than
lteStringLess than or equal
gtStringGreater than
gteStringGreater than or equal
in[String!]Is in the array
notIn[String!]Is not in the array
notDateTimeNullableFilterDoes not match the inner filter

Relationship type

relationship

many: true

Filter nameTypeDescription
everyFooWhereInputAll related items match the nested filter
someFooWhereInputSome related items match the nested filter
noneFooWhereInputNo related items match the nested filter

many: false

Filter nameTypeDescription
fooFooWhereInputMatches the nested filter

Virtual type

virtual

The virtual field type does not support filters.

File types

file

The file field type does not support filters.

image

The image field type does not support filters.