Skip to content

Instantly share code, notes, and snippets.

@adispen
Last active June 25, 2016 12:18
Show Gist options
  • Save adispen/c74a8bf64b66eea6a82131a11ccf979f to your computer and use it in GitHub Desktop.
Save adispen/c74a8bf64b66eea6a82131a11ccf979f to your computer and use it in GitHub Desktop.
db['streams'].aggregate([
{"$unwind":"$stats"},
{"$match":{"$and":[{"stats.rank":{"$lt":10}}, {"stats.time":{"$gt":"2016.06.25.07.00.42"}}]}},
{"$group":{"_id":{"stats":"$stats","name":"$name"}}},
{"$project":{"stats":"$_id.stats","name":"$_id.name","_id":0,"viewers":"$_id.stats.viewers","time":"$_id.stats.time"}},
{"$limit":10000}
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment