Skip to content

Instantly share code, notes, and snippets.

@iamtrk

iamtrk/query.txt

Last active Dec 19, 2015
Embed
What would you like to do?
M101J from 10Gen Education -> Final exam
Final: Question 2
Please use the Enron dataset you imported for the previous problem. For this question you will use the aggregation framework to figure out pairs of people that tend to communicate a lot(list Top5 pairs).
Query :
db.messages.aggregate([{$unwind:"$headers.To"},{$group:{_id:{from:"$headers.From",to:"$headers.To"},numbe:{$sum:1}}},{$sort:{numbe:-1}},{$limit:5}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment