Filter operators for tables
Use filter (query) operators to find rows in a table.
You can use filter operators on all supported types except map
, list
, set
, and vector
.
For examples, see the references for commands that use these operators, such as Find a row, Find rows, and Find distinct values.
Operator type | Name | Purpose |
---|---|---|
Comparison query (Range) |
|
Matches rows where the given column’s value is greater than the specified value. |
|
Matches rows where the given column’s value is greater than or equal to the specified value. |
|
|
Matches rows where the given column’s value is less than the specified value. |
|
|
Matches rows where the given column’s value is less than or equal to the specified value. |
|
Comparison query (Exact) |
|
|
|
Matches rows where a given column’s value does not equal the specified value. |
|
|
Match one or more of an array of specified values.
For example, If you have only one value to match, an array is not necessary, such as |
|
|
Matches any of the values that are NOT IN a given array. |
Examples
The $eq
(equals) operator finds exact matches.
The following example retrieves rows where the customer
column has the name "Jasmine S." and the city "Jersey City":
"find": {
"filter": {
"customer": {
"$eq": {
"name": "Jasmine S.",
"city": "Jersey City"
}
}
}
}
$eq
is the default operator if you do not specify an operator:
"find": {
"filter": {
"customer": { "name": "Jasmine S.", "city": "Jersey City" }
}
}
Use $ne
to match rows that do not have the given filter value:
"find": {
"filter": {
"$ne": {
"state": "NJ"
}
}
}
Use $in
to match any of a series of specified values:
"find": {
"filter": {
"city": {
"$in": [ "Jersey City", "Orange" ]
}
}
}
Similarly, use $nin
to match rows that don’t have any of the specified values.