Skip to content

Instantly share code, notes, and snippets.

@ahachete
Created November 30, 2016 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahachete/f2650ca5aafcdd139281997efe50e335 to your computer and use it in GitHub Desktop.
Save ahachete/f2650ca5aafcdd139281997efe50e335 to your computer and use it in GitHub Desktop.
db.events.aggregate(
[
{ $match: { "type": "PushEvent" } },
{ $project: { "repo.name": 1, "actor.login": 1 } },
{ $group:
{
_id: "$repo.name",
actor: { $first: "$actor.login"},
count: { $sum: 1 }
}
},
{ $group:
{
_id: "$_id",
count: { $sum: 1 }
}
},
{ $sort: { count: -1 } }
],
{ allowDiskUse: true, cursor: { batchSize: 100000000 } }
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment