[SERVER-32789] Add $product to calculate aggregate multiplication Created: 19/Jan/18 Updated: 19/Jan/18 Resolved: 19/Jan/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | 3.6.0 |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Yair Lenga | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Description |
|
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. |
| Comments |
| Comment by Charlie Swanson [ 19/Jan/18 ] |
|
Thanks for reporting this issue. We already have a similar request in SERVER-10682, so I'm resolving this one as a duplicate. Please watch SERVER-10682 for updates. Note that while that ticket requests a different name, none of the syntax is final until we start development, at which time we'll discuss which syntax makes the most sense and is the most consistent. |