JSON Conditions
Schema
{
"operator": "string",
"path": "string",
"case_sensitive": true|false,
"default": true|false,
"value": "any",
"value_path": "string",
"value_type": "string",
"match_type": "all|any",
"conditions": [
{}
]
}Fields
operator (Required)
operator (Required)Specifies the logical or comparison operation to perform.
| Operator | Description |
|---|---|
and | All child conditions must be true. If no children, evaluates to false. |
or | At least one child condition must be true. If no children, evaluates to true. |
not | Negates the result of its single child condition. If no children, evaluates to false. |
eq | (Equals) The value at path must be equal to value. |
ne | (Not Equals) The value at path must not be equal to value. |
gt | (Greater Than) The value at path must be greater than value. |
gte | (Greater Than or Equal) The value at path must be greater than or equal to value. |
lt | (Less Than) The value at path must be less than value. |
lte | (Less Than or Equal) The value at path must be less than or equal to value. |
match | The string value at path must match the regular expression provided in value. |
exists | The JSON path specified in path must exist in the document. |
tree | Applies child conditions to a subtree identified by path. |
istype | The JSON element at path must be of the type specified in value (e.g., "string", "integer", "array"). |
count | The number of elements at path must be equal to value. |
countlt | The number of elements at path must be less than value. |
countgt | The number of elements at path must be greater than value. |
in | The value at path must be present in the array specified by value. |
isnull | The value at path must be null. |
isnotnull | The value at path must not be null. |
conditions
conditionsA list of child conditions. Used with logical operators (and, or, not, tree).
path
pathThe dot notation JSON path pointing to the element(s) in the document to evaluate, e.g. user.address.city or items[*].price
value
valueThe value to compare against the document's data at path. The type should align with value_type.
value_path
value_pathAn alternative to value. If specified, the value to compare against will be dynamically retrieved from the document itself using this dot notation JSON path.
value_type
value_typeSpecifies the data type for comparison; values are
| Value | Description |
|---|---|
string | Compares values as strings. |
number | Compares values as numbers (integers or floats). |
date | Compares values as dates. Dates should be in ISO 8601 format. |
bool | Compares values as booleans. |
case_sensitive
case_sensitiveIf true, string comparisons (e.g., eq, ne, match) will be case-sensitive.
match_type
match_typeWhen path resolves to multiple tokens (e.g. an array), this defines how the condition is applied.
all: The condition must be true for all resolved tokens.any: The condition must be true for at least one resolved token.
default
defaultIf true, and the path does not exist, the condition will evaluate to true. This is useful for providing default behavior when data is optional.
Examples
Simple Equality Check
Match documents where status is active.
{
"operator": "eq",
"path": "status",
"value": "active",
"case_sensitive": false
}Logical AND
Match documents where category is "electronics" AND price is greater than 500.
{
"operator": "amd",
"conditions": [
{
"operator": "eq",
"path": "category",
"value": "electronics",
"case_sensitive": false
},
{
"operator": "gt",
"path": "price",
"value": 500,
"value_type": "number"
}
]
}Logical OR with Case-Insensitive Match
Match documents where tag is urgent (case-insensitive) OR priority is high.
{
"operator": "or",
"conditions": [
{
"operator": "eq",
"path": "tag",
"value": "urgent",
"case_sensitive": false
},
{
"operator": "eq",
"path": "priority",
"value": "high",
"case_sensitive": false
}
]
}Existence Check
Match documents that have a metadata.timestamp field.
{
"operator": "exists",
"path": "metadata.timestamp",
}Regular Expression Match
Match documents where product_code starts with "ABC-".
{
"condition": "match",
"path": "product_code",
"value": "^ABC-.*$",
"case_sensitive": false
}Array Element Matching (match_type)
match_type)Match documents where any item in the tags array is "featured".
{
"operator": "eq",
"path": "tags[*]",
"value": "featured",
"match_type": "any"
}Dynamic Value Comparison (value_path)
value_path)Match documents where item.price is greater than item.cost.
{
"operator": "gt",
"path": "item.price",
"value_path": "item.cost",
"value_type": "number"
}Count Operator
Match documents where the $.items array has exactly 3 elements.
{
"operator": "count",
"path": "items",
"value": 3,
"value_type": "number"
}IsNull
Match documents where description is null.
{
"operator": "isnull",
"path": "description"
}Updated about 2 hours ago
