Misc Operators
Besides the main categories of operators, ReductStore supports a few miscellaneous operators that provide additional functionality:
Operator | Description |
---|---|
$has | $exists | Checks if a record has specific labels. |
$cast | Casts a label value to a different type explicitly. |
$ref | References a label value in a record explicitly. |
$timestamp | $id | Retrieves the timestamp of a record as a UNIX time in microseconds. |
$has | $exists
The $has
or $exists
operator is used to check if a record has specific labels.
The operator is useful when you want to filter records based on the presence of a label, regardless of its value.
Syntax
{
"$has" | "$exists" : [ <expression as label reference>, ... ]
}
Behavior
The operator evaluates expressions as strings and checks if the record has all the specified labels.
Additional rules:
- If the expression is not a string, it is cast to a string.
- The operator is case-sensitive.
- The evaluation stops as soon as one of the labels is not found.