'How do i get the sum of fields in mongodb?
I have created the pipeline which will find the sum of the field I want but I just cant find a way to execute it in the node js project and get the sum as the result.
Solution 1:[1]
Try this:
{ $sum: [ <expression1>, <expression2>] }
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Muhammad Umer |
