Skip to content

Instantly share code, notes, and snippets.

@peterzawistowicz
Created May 27, 2015 21:12
Show Gist options
  • Save peterzawistowicz/7fcf51cad16a1e771d6f to your computer and use it in GitHub Desktop.
Save peterzawistowicz/7fcf51cad16a1e771d6f to your computer and use it in GitHub Desktop.
db.activities.aggregate(([
{ $match: { userId:"u123", ts:{$gt:DATE}, type:"ORDER"}},
{ $group: { _id: "result", count: {$sum: "$total" }}}]) // sum the total of all orders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment