On Related Object Value

Queries by related object.

Querying objects also support subqueries, which are defined with keywords $inQuery and $notInQuery, and can be applied only to pointer fields.

Examples

curl -X POST \
  -H "X-Appery-Database-Id: 544a5cdfe4b03d005b6233b9" \
  -H "Content-Type: application/json" \
  -d '{"where":{"subtask": {"$inQuery": {"priority": "High"}}}}' \
  https://api.appery.io/rest/1/db/collections/todo/query
Such a query will return only the objects linked to the objects returned by the subquery. In this example, you get an object that has a pointer to the objects with only a High-value in the priority field.

$notInQuery works inversely: the parent query will return the objects not linked to objects returned by the subquery.

How to get all students collection objects, where the owner column doesn’t reference a user named Alice:

curl -X POST \
  -H "X-Appery-Database-Id: 544a5cdfe4b03d005b6233b9" \
  -H "Content-Type: application/json" \
  -d '{"where":{"owner": {"$notInQuery": {"username": "Alice"}}}}' \
  https://api.appery.io/rest/1/db/collections/students/query