-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.6.0
-
Component/s: Aggregation Framework
-
None
Add a '$product' aggregation function, which will work like the '$sum' operation, using multiplication (instead of addition) to calculate the total across records.
Aggregation by multiplication is common operation used in financial application for calculating compounded values (e.g., returns), and in scientific applications (e.g., when result are used to measure growth).
The new operator should be available in any place where $sum is allowed (aggregation, grouping, projection).
The result of the operator should be the multiplication of all values RESULT = v1 * v2 * v3
It should be possible, like the $sum, to provide expressions, and to provide inputs.
- duplicates
-
SERVER-10682 Expose $multiply as both an accumulator and an expression
- Backlog