Skip to main content

$sum

The $sum operator returns the sum of all numeric input values.

Input

  • An array of numeric values to sum

Output

  • The sum of all input values (returns 0 if no values provided)

Examples

Sum of Multiple Values

Result: 10

Sum of Field Values

Result: The sum of value1, value2, and value3 fields

No Values

Result: 0