Query filters

To filter data, you can use query filters.

The available operator sets for query filters depend on the data type.

To apply a query filter to a <data_type> type, use the input <data_type>Filter input.

For example, for a String data type, use input StringFilter.

Filters for each data type

StringFilter

OperatorDescription
eq= Equals
ne<> or != Not Equals
inAllows you to specify multiple string values
ninAllows you to specify multiple string values
containsContains target string
regexRegular expression search

Examples

<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  cars(query: { </span><span style="color: var(--shiki-token-string)">carName</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">eq</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-string-expression)">&quot;XXX&quot;</span><span style="color: var(--shiki-color-text)"> } }) {</span></span>
<span><span style="color: var(--shiki-color-text)">    collection {</span></span>
<span><span style="color: var(--shiki-color-text)">      id</span></span>
<span><span style="color: var(--shiki-color-text)">    }</span></span>
<span><span style="color: var(--shiki-color-text)">  }</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>
<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  cars(query: { </span><span style="color: var(--shiki-token-string)">carName</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">regex</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-string-expression)">&quot;[0-9]+&quot;</span><span style="color: var(--shiki-color-text)"> } }) {</span></span>
<span><span style="color: var(--shiki-color-text)">    collection {</span></span>
<span><span style="color: var(--shiki-color-text)">      id</span></span>
<span><span style="color: var(--shiki-color-text)">    }</span></span>
<span><span style="color: var(--shiki-color-text)">  }</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>
<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  cars(query: { </span><span style="color: var(--shiki-token-string)">carName</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">contains</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-string-expression)">&quot;YY&quot;</span><span style="color: var(--shiki-color-text)"> } }) {</span></span>
<span><span style="color: var(--shiki-color-text)">    collection {</span></span>
<span><span style="color: var(--shiki-color-text)">      id</span></span>
<span><span style="color: var(--shiki-color-text)">    }</span></span>
<span><span style="color: var(--shiki-color-text)">  }</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

Integer, Float, DateTime, Date, and Time Filters

OperatorDescription
eq=Equals
ne<>or != Not Equals
lt< Less Than
lte<= Less Than Equals
gt> Greater Than
gte>= Greater Than Equals
between{min:x, max: y}
x <= n && n <= y Between x and y.
inin: [x, y …. ] Allows you to specify multiple values (n == x or n == y)
ninnin: [x, y …. ] Allows you to specify multiple values (n != x and n != y)

Examples

<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  cars(query: { </span><span style="color: var(--shiki-token-string)">carNumber</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">gt</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-constant)">10</span><span style="color: var(--shiki-color-text)"> } }) {</span></span>
<span><span style="color: var(--shiki-color-text)">    collection {</span></span>
<span><span style="color: var(--shiki-color-text)">      id</span></span>
<span><span style="color: var(--shiki-color-text)">    }</span></span>
<span><span style="color: var(--shiki-color-text)">  }</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>
<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  cars(query: { </span><span style="color: var(--shiki-token-string)">carNumber</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">between</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">min</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-constant)">5</span><span style="color: var(--shiki-color-text)">, </span><span style="color: var(--shiki-token-string)">max</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-constant)">10</span><span style="color: var(--shiki-color-text)"> } } }) {</span></span>
<span><span style="color: var(--shiki-color-text)">    collection {</span></span>
<span><span style="color: var(--shiki-color-text)">      id</span></span>
<span><span style="color: var(--shiki-color-text)">    }</span></span>
<span><span style="color: var(--shiki-color-text)">  }</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>
<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  cars(query: { </span><span style="color: var(--shiki-token-string)">carNumber</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">in</span><span style="color: var(--shiki-color-text)">: [</span><span style="color: var(--shiki-token-constant)">1</span><span style="color: var(--shiki-color-text)">, </span><span style="color: var(--shiki-token-constant)">2</span><span style="color: var(--shiki-color-text)">, </span><span style="color: var(--shiki-token-constant)">3</span><span style="color: var(--shiki-color-text)">] } }) {</span></span>
<span><span style="color: var(--shiki-color-text)">    collection {</span></span>
<span><span style="color: var(--shiki-color-text)">      id</span></span>
<span><span style="color: var(--shiki-color-text)">    }</span></span>
<span><span style="color: var(--shiki-color-text)">  }</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

EnumFilter

OperatorDescription
eq=Equals enum value
ne<>or != Not Equals enum value
inin: [x, y …. ] Allows you to specify multiple enum values (n == x or n == y)
ninnin: [x, y …. ] Allows you to specify multiple enum values (n != x and n != y)

UUIDFilter

OperatorDescription
eq=Equals enum value
ne<>or != Not Equals enum value
inin: [x, y …. ] Allows you to specify multiple id values (n == x or n == y)
ninnin: [x, y …. ] Allows you to specify multiple id values (n != x and n != y)

BooleanFilter

OperatorDescription
eq=Equals enum value
ne<>or != Not Equals enum value

Advanced Filters

And, Or and Not Operators

You can combine filter conditions with logical AND, logical OR, and negation (NOT) across all types.

OperatorDescription
andand:{condition1, condition2 }
oror:{condition1, condition2 }
notnot:{condition}

Examples

<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  cars(query: { </span><span style="color: var(--shiki-token-string)">and</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">carName</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">eq</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-string-expression)">&quot;XXX&quot;</span><span style="color: var(--shiki-color-text)"> }, </span><span style="color: var(--shiki-token-string)">carNumber</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">gt</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-constant)">10</span><span style="color: var(--shiki-color-text)"> } } }) {</span></span>
<span><span style="color: var(--shiki-color-text)">    collection {</span></span>
<span><span style="color: var(--shiki-color-text)">      id</span></span>
<span><span style="color: var(--shiki-color-text)">    }</span></span>
<span><span style="color: var(--shiki-color-text)">  }</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>
<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  cars(query: { </span><span style="color: var(--shiki-token-string)">not</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">carName</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">eq</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-string-expression)">&quot;XXX&quot;</span><span style="color: var(--shiki-color-text)"> } } }) {</span></span>
<span><span style="color: var(--shiki-color-text)">    collection {</span></span>
<span><span style="color: var(--shiki-color-text)">      id</span></span>
<span><span style="color: var(--shiki-color-text)">    }</span></span>
<span><span style="color: var(--shiki-color-text)">  }</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

If you want to set multiple conditions for the same field, please use between: {min:x, max: y}, in: [x, y ….], or nin: [x, y ….], instead of using and/or.

You can also nest the and/or/not queries.

<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  cars(</span></span>
<span><span style="color: var(--shiki-color-text)">    query: { </span><span style="color: var(--shiki-token-string)">or</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">not</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">carName</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">eq</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-string-expression)">&quot;XXX&quot;</span><span style="color: var(--shiki-color-text)"> } }, </span><span style="color: var(--shiki-token-string)">carNumber</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">gt</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-constant)">10</span><span style="color: var(--shiki-color-text)"> } } }</span></span>
<span><span style="color: var(--shiki-color-text)">  ) {</span></span>
<span><span style="color: var(--shiki-color-text)">    collection {</span></span>
<span><span style="color: var(--shiki-color-text)">      id</span></span>
<span><span style="color: var(--shiki-color-text)">    }</span></span>
<span><span style="color: var(--shiki-color-text)">  }</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

Null condition

For all types except Boolean, it is possible to filter on null values with the eq and ne operators.

Examples

<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  cars(query: { </span><span style="color: var(--shiki-token-string)">carNumber</span><span style="color: var(--shiki-color-text)">: { </span><span style="color: var(--shiki-token-string)">eq</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-constant)">null</span><span style="color: var(--shiki-color-text)"> } }) {</span></span>
<span><span style="color: var(--shiki-color-text)">    collection {</span></span>
<span><span style="color: var(--shiki-color-text)">      id</span></span>
<span><span style="color: var(--shiki-color-text)">    }</span></span>
<span><span style="color: var(--shiki-color-text)">  }</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>