Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function my_aggregate() {
- db.zips.aggregate([{ $match: { state: { $in: [ "CA", "NY" ] } }},{ $group:{ _id : { "state" : "$state","city" : "$city" }, pop : { $sum: "$pop"}}},{ $match: { pop: { $gt: 25000 } }},{$group:{ _id : { "city" : "$city"}, pop : { $avg: "$pop"}}}]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement