Last active
August 29, 2015 14:01
-
-
Save mdippery/8ff4973b4a151304d517 to your computer and use it in GitHub Desktop.
Group a set of MongoDB documents by day, finding the maximum value for each day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.samples.aggregate([ {$match: {user: 28804}}, {$group: {_id: {year: {$year: "$timestamp"}, month: {$month: "$timestamp"}, day: {$dayOfMonth: "$timestamp"}}, reputation: {$max: "$reputation"}}}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment