Data evaluation operators
JSON data evaluation operators provide ways to locate data within the database. They work in different manners for queries on individual documents and aggregation queries.
- $size
- The $size operator returns the number of documents if the array
field is of the specified size. The following example uses the $size
operator:
{"arr":{"$size":4}}
- $mod
- The $mod operator performs a modulo operation on the value of
the field and returns the document that meets the specified result.
The following examples use the $mod operator:
- The following query finds the value that has a remainder of 1
after it is divided by 4:
{"age":{"$mod":[4,1]}}
- The following query finds the value that has a remainder of 0
after it is divided by 5:
{"age":{"$mod":[5]}}
- The following query finds the value that has a remainder of 1
after it is divided by 4:
For details about supported data evaluation operators in queries that are constructed by using aggregation tasks, see the topic about aggregation tasks and operators.