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:
| Operator | Description |
|---|---|
$eq | Equal |
$eqi | Equal (case-insensitive) |
$ne | Not equal |
$nei | Not equal (case-insensitive) |
$lt | Less than |
$lte | Less than or equal to |
$gt | Greater than |
$gte | Greater than or equal to |
$in | Included in an array |
$notIn | Not included in an array |
$contains | Contains |
$notContains | Does not contain |
$containsi | Contains (case-insensitive) |
$notContainsi | Does not contain (case-insensitive) |
$null | Is null |
$notNull | Is not null |
$between | Is between |
$startsWith | Starts with |
$startsWithi | Starts with (case-insensitive) |
$endsWith | Ends with |
$endsWithi | Ends with (case-insensitive) |
$or | Joins the filters in an "or" expression |
$and | Joins the filters in an "and" expression |
$not | Joins the filters in an "not" expression |
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()$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.
$not can be used as:
- a logical operator (e.g. in
filters: { $not: { // conditions... }}) - an attribute operator (e.g. in
filters: { attribute-name: $not: { ... } }).
$and, $or and $not operators are nestable inside of another $and, $or or $not operator.