Navigation

Aggregation Options

Dragging a field onto an aggregation encoding channel allows you to use an aggregation pipeline operator on that field.

The aggregation pipeline operators available in the chart builder change based on the data type of the selected field. MongoDB Charts categorizes the field data type as either a number, string, or date and displays appropriate aggregation options accordingly.

The following tables list the available aggregation options for each data type:

Aggregation Option
Description
Pipeline Operation
sum
Sums all values in the field.
count
Counts the number of documents with a value in the field.
count by value
Counts the number of distinct values in the field and creates a series based on the values.
distinct
Counts the number of unique values in the field.
Applies $addToSet and counts the number of items in the result set with $size.
mean
Averages all values in the field.
min
Returns the minimum value in the field.
max
Returns the minimum value in the field.
variance
Calculates the sample variance of values in the field.
Applies $stdDevSamp and raises the result to the 2nd power with $pow.
variancep
Calculates the population variance of values in the field.
Applies $stdDevPop and raises the result to the 2nd power with $pow.
stdev
Calculates the sample standard deviation of values in the field.
stdevp
Calculates the population standard deviation of values in the field.
Aggregation Option
Description
Pipeline Operation
count
Counts the number of documents with a value in the field.
count by value
Counts the number of distinct values in the field and creates a series based on the values.
distinct
Counts the number of unique values in the field.
Applies the $addToSet operator and counts the number of items in the result set with $size.
Give Feedback

On this page

  • Numbers
  • Strings and Dates