Multiple where clauses.
The Appery.io database also supports multiple where clauses. Read more about this on the MongoDB documentation page.
Multiple where examples.
Logical OR ($or)
The $or operator performs a logical OR operation on an array of two or more expressions, and selects the documents that satisfy at least one of the expressions.
curl -X POST \
-H "X-Appery-Database-Id:544a5cdfe4b03d005b6233b9" \
-H "Content-Type: application/json" \
-d '{"where":{"$or": [{"studentId": 50},{"studentName": "Dan"}]}}' \
https://api.appery.io/1/db/collections/students/query
Example above means that the returned object must contain {"studentId":50} OR {"studentName":"Dan"}.
Logical AND ($and)
$and performs a logical AND operation on an array of two or more expressions and selects the documents that satisfy all the expressions in the array. The $and operator uses short-circuit evaluation: If the first expression evaluates to false, remaining expressions will not be evaluated:
curl -X POST \
-H "X-Appery-Database-Id: 544a5cdfe4b03d005b6233b9" \
-H "Content-Type: application/json" \
-d '{"where":{"$and": [{"priority": "Low"},{"taskName": "Create an app"}]}}' \
https://api.appery.io/1/db/collections/todo/query
Example above means that the returned object must contain {"studentId":50} AND {"studentName":"Dan"}.
Logical NOR ($nor)
$nor performs a logical NOR operation on an array of one or more query expressions and selects the documents that fail all the query expressions in the array:
curl -X POST \
-H "X-Appery-Database-Id: 544a5cdfe4b03d005b6233b9" \
-H "Content-Type: application/json" \
-d '{"where":{"$nor": [{"studentName": "John"}, {"studentId": 50}]}}' \
https://api.appery.io/1/db/collections/students/query
Example above means that the returned object must NOT contain {"studentName":"John"} AND {"studentId": 50}.