Boolean Operators
and (Boolean AND)
The 'and' operator returns Boolean true if both operands evaluate to true. If either or both operands is not a Boolean type, then they are first cast to a Boolean using the rules of the $boolean function.
Example
Input:
{
"library": {
"books": [
{
"title": "Pride and Prejudice",
"authors": ["Jane Austen"],
"price": 49
},
{
"title": "Persuasion",
"authors": ["Jane Austen"],
"price": 51
},
{
"title": "One Hundred Years of Solitude",
"authors": ["Gabriel García Márquez"],
"price": 48
}
]
}
}Expression:
library.books["Jane Austen" in authors and price < 50].titleResult:
"Pride and Prejudice"or (Boolean OR)
The 'or' operator returns Boolean true if either operand evaluates to true. If either or both operands is not a Boolean type, then they are first cast to a Boolean using the rules of the $boolean function.
Example
Input:
{
"library": {
"books": [
{
"title": "Pride and Prejudice",
"authors": ["Jane Austen"],
"price": 49
},
{
"title": "Persuasion",
"authors": ["Jane Austen"],
"price": 51
},
{
"title": "One Hundred Years of Solitude",
"authors": ["Gabriel García Márquez"],
"price": 48
}
]
}
}Expression:
library.books["Jane Austen" in authors or price < 50].titleResult:
["Pride and Prejudice", "Persuasion", "One Hundred Years of Solitude"]Please note that Boolean 'NOT' is a function, not an operator.