Skip to content

Instantly share code, notes, and snippets.

@ppillip
Created March 9, 2013 23:13
Show Gist options
  • Save ppillip/5126216 to your computer and use it in GitHub Desktop.
Save ppillip/5126216 to your computer and use it in GitHub Desktop.
// RDB - select birth , working , count(*) from users group by birth , working
// mongoDB aggregation
db.users.aggregate([
{ $project : { a : "$birth"
, b : "$working"
, _id : 0 }}
,{ $group : { _id : { a:"$a",b:"$b"}
, n: { $sum:1 }
}
}
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment