Skip to main content

Document Service API: Filters

Page summary:

The Document Service API provides attribute operators ($eq, $lt, $contains, etc.) and logical operators ($and, $or, $not) to filter query results with support for case-sensitive and case-insensitive matching.

The Document Service API offers the ability to filter results.

The following operators are available:

OperatorDescription
$eqEqual
$eqiEqual (case-insensitive)
$neNot equal
$neiNot equal (case-insensitive)
$ltLess than
$lteLess than or equal to
$gtGreater than
$gteGreater than or equal to
$inIncluded in an array
$notInNot included in an array
$containsContains
$notContainsDoes not contain
$containsiContains (case-insensitive)
$notContainsiDoes not contain (case-insensitive)
$nullIs null
$notNullIs not null
$betweenIs between
$startsWithStarts with
$startsWithiStarts with (case-insensitive)
$endsWithEnds with
$endsWithiEnds with (case-insensitive)
$orJoins the filters in an "or" expression
$andJoins the filters in an "and" expression
$notJoins the filters in an "not" expression
Deep filtering with the various APIs

For examples of how to deep filter with the various APIs, please refer to this blog article.

Attribute operators


strapi.documents().findMany()

$not

Negates the nested condition(s).

strapi.documents().findMany()

$eq

Attribute equals input value.

strapi.documents().findMany()

$eqi

Attribute equals input value (case-insensitive).

strapi.documents().findMany()

$ne

Attribute does not equal input value.

strapi.documents().findMany()

$nei

Attribute does not equal input value (case-insensitive).

strapi.documents().findMany()

$in

Attribute is contained in the input list.

strapi.documents().findMany()

$notIn

Attribute is not contained in the input list.

strapi.documents().findMany()

$lt

Attribute is less than the input value.

strapi.documents().findMany()

$lte

Attribute is less than or equal to the input value.

strapi.documents().findMany()

$gt

Attribute is greater than the input value.

strapi.documents().findMany()

$gte

Attribute is greater than or equal to the input value.

strapi.documents().findMany()

$between

Attribute is between the 2 input values, boundaries included (e.g., $between[1, 3] will also return 1 and 3).

strapi.documents().findMany()

$contains

Attribute contains the input value (case-sensitive).

strapi.documents().findMany()

$notContains

Attribute does not contain the input value (case-sensitive).

strapi.documents().findMany()

$containsi

$containsi is not case-sensitive, while $contains is.

strapi.documents().findMany()

$notContainsi

$notContainsi is not case-sensitive, while $notContains is.

strapi.documents().findMany()

$startsWith

Attribute starts with input value (case-sensitive).

strapi.documents().findMany()

$startsWithi

Attribute starts with input value (case-insensitive).

strapi.documents().findMany()

$endsWith

Attribute ends with input value (case-sensitive).

strapi.documents().findMany()

$endsWithi

Attribute ends with input value (case-insensitive).

strapi.documents().findMany()

$null

Attribute is null.

strapi.documents().findMany()

$notNull

Attribute is not null.

Logical operators

strapi.documents().findMany()

$and

All nested conditions must be true.

strapi.documents().findMany()

$or

One or many nested conditions must be true.

strapi.documents().findMany()

$not

Negates the nested conditions.

Note

$not can be used as:

  • a logical operator (e.g. in filters: { $not: { // conditions... }})
  • an attribute operator (e.g. in filters: { attribute-name: $not: { ... } }).
Tip

$and, $or and $not operators are nestable inside of another $and, $or or $not operator.

Was this page helpful?