Operator | Description | Example |
---|---|---|
$count | Performs a count of a grouped documents or, if the property is an array, a count of the number of elements. | {“numInGroup”: {“$count”: “_id”}} |
$sum | Calculates the sum of a number property or expression in the group. | {“sumOfDays”: {“$sum”: {“$dayOfMonth”: “created”}}} |
$avg | Calculates the average of a number property or expression in the group. | {“averageHeartRate”: {“$avg”: “c_bpm”}} |
$first | Returns the first value from the group. The result depends on the sort field(s). | {“oldest”: {“$first”: “created”}} |
$last | Returns the last value from the group. The result depends on the sort field(s). | {“latest”: {“$last”: “created”}} |
$min | Returns the smallest value from the group. | {“smallest”: {“$min”: “c_size”}} |
$max | Returns the largest value from the group. | {“largestArray”: {“$max: {”$size": “c_arr”}}} |
$pushAll | Returns the array of pushed values, with NULL included in the array where there are missing values | {"combinedArray": {"$pushAll": "c_value"}} |
$push | Returns the array of pushed values | {"combinedArray": {"$push": "c_value"}} |
$addToSet | Returns array of unique pushed values | {"uniqueArray": {"$addToSet": "c_value"}} |
$stdDevPop | Returns the population standard deviation of input values | {"stdDeviation": { "$stdDevPop": "c_heartrate"}} |
$stdDevSamp | Returns the sample standard deviation of input values | {"stdDeviation": { "$stdDevSamp": "c_heartrate"}} |