Condition Expression
Overview
A condition expression is an expression that defines a condition for executing an operation, based on the attributes of the items against which the expression is evaluated.
For example, the NoSQL Web API
Filter Expression
For operations that retrieve existing item attributes, the condition expression acts as a filter expression that restricts the operation to a subset of items to be returned in the response.
For example, the NoSQL Web API
Syntax
"CONDITION [LOGICAL-OPERATOR CONDITION ...]"
A condition expression is a Boolean expression that is composed of one or more Boolean expressions (CONDITION
) that are connected using a binary logical operator (LOGICAL-OPERATOR
) — AND
or OR
.
The unary logical operator NOT
can be used to negate a condition.
A condition can optionally be enclosed within parentheses.
false
).
The result of the entire condition expression depends on the expression's overall logic.Examples
-
Check for "Car" products with less than 15 known bugs:
"(bugs < 15) AND starts(Product_Name, 'Car')"
-
Check for 40-year-old people whose first names are "John" and are not residents of Arizona or Massachusetts:
"(age == 40) and (firstName == 'John') and NOT(State IN ('AZ','MA'))"
-
Check whether the value of the third element in an
"intArray"
array attribute equals the sum of the first two elements in the array:"intArray[2] == intArray[0] + intArray[1]"
-
Check whether the value of the first or second elements of an
"arr"
array attribute is 7:"arr[0]==7 OR arr[1]==7"
-
Check for released adult prisoners who haven't reported to their parole officer:
"(age > 18) AND isReleased==true AND reported==false"
-
Check whether the first or last five elements of a
"ctrs"
array contain the highest value:"max(ctrs[0..4]) > max(ctrs[5..9])"