Created
November 1, 2018 21:25
-
-
Save basedalexander/a0d37ff72cbf5d4aa30a4126052290e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get sum of a certain field across all the documents in a collection | |
| db.getCollection('simple-arb').aggregate([ | |
| { | |
| $match: { | |
| closed: { | |
| $eq: true | |
| } | |
| } | |
| }, { | |
| $group: { | |
| _id: null, | |
| total: { | |
| $sum: "$actualProfit" | |
| } | |
| } | |
| } | |
| ]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment