Skip to content

Instantly share code, notes, and snippets.

View danielbellido's full-sized avatar

danielbellido

View GitHub Profile
// homework 5.1
db.posts.aggregate([
{$project: {"_id": 0,
"comments.author": 1
}},
{$unwind: "$comments"},
{$group: {"_id": "$comments.author",
sum: {"$sum": 1}
}},
{$sort: {"sum": -1}},