Accumulators

push(field) Pushes the value of the selected field from a group into an array.

pushU(field) Pushes only the unique value of the selected field from a group into an array.

pushUC(field) Pushes only the unique value of the selected field from a group into an array in a cumulative way.

average(field) Returns the average of the values of the selected field from a group.

The field argument must be numeric. Non-numeric values or missing values will be ignored.

averageC(field) Returns the average of the values of the selected field from a group in a cumulative way.

The field argument must be numeric. Non-numeric values or missing values will be ignored.

sum(field) Returns the sum of the values of the selected field from a group.

The field argument must be numeric. Non-numeric values will be ignored.

sumC(field) Returns the sum of the values of the selected field from a group in a cumulative way.

The field argument must be numeric. Non-numeric values will be ignored.

max(field) Returns the maximum value of the selected field from a group.

The field argument must be numeric. If it has null or has no value at all, it will be ignored.

min(field) Returns the minimum value of the selected field from a group.

The field argument must be numeric. If it has null or has no value at all, it will be ignored.

first(sort, order) Returns the first document from a group. The group can be either sorted or not.

sort: Allows you to specify which field to sort. No sorting will happen if left empty.

order: 1 means ascending; -1 means descending. The default value is 1.

Last updated