Accumulators calculate aggregated values like sums, maxima, and minima across a variable number of input values. You can use accumulators in these aggregation pipeline stages:
| Name | Description | 
|---|---|
| Returns the result of a user-defined accumulator function. | |
| Returns an array of unique expression values for each group. Order of the array elements is undefined. Changed in version 5.0: Available in the  | |
| Returns an average of numerical values. Ignores non-numeric values. Changed in version 5.0: Available in the  | |
| Returns the bottom element within a group according to the specified sort order. New in version 5.2. Available in the  | |
| Returns an aggregation of the bottom  New in version 5.2. Available in the  | |
| Returns a single array that combines the elements of two or more arrays. New in version 8.1. | |
| Returns the number of documents in a group. Distinct from the  New in version 5.0: Available in the  | |
| Returns the result of an expression for the first document in a group. Changed in version 5.0: Available in the  | |
| Returns an aggregation of the first  New in version 5.2: Available in the  | |
| Returns the result of an expression for the last document in a group. Changed in version 5.0: Available in the  | |
| Returns an aggregation of the last  New in version 5.2: Available in the  | |
| Returns the highest expression value for each group. Changed in version 5.0: Available in the  | |
| Returns an aggregation of the  New in version 5.2. Available in  | |
| Returns an approximation of the median, the 50th percentile, as a scalar value. New in version 7.0. This operator is available as an accumulator in these stages: It is also available as an aggregation expression. | |
| Returns a document created by combining the input documents for each group. | |
| Returns the lowest expression value for each group. Changed in version 5.0: Available in the  | |
| Returns an aggregation of the  New in version 5.2. Available in  | |
| Returns an array of scalar values that correspond to specified percentile values. New in version 7.0. This operator is available as an accumulator in these stages: It is also available as an aggregation expression. | |
| Returns an array of expression values for documents in each group. Changed in version 5.0: Available in the  | |
| Takes two or more arrays and returns an array containing the elements that appear in any input array. New in version 8.1. | |
| Returns the population standard deviation of the input values. Changed in version 5.0: Available in the  | |
| Returns the sample standard deviation of the input values. Changed in version 5.0: Available in the  | |
| Returns a sum of numerical values. Ignores non-numeric values. Changed in version 5.0: Available in the  | |
| Returns the top element within a group according to the specified sort order. New in version 5.2. Available in the  | |
| Returns an aggregation of the top  New in version 5.2. Available in the  |