-
-
Save habedi/3c6e6b2d2befca6b26cf1e5e6ac083e2 to your computer and use it in GitHub Desktop.
MongoDB: group by day (aggregate)
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
var mention_id = 620996; | |
db.mentionStats.aggregate([ | |
{ $match: {'mention_id': mention_id}}, | |
{ $group: {'_id': { | |
'year': { '$year': "$verification_date" }, | |
'month': { '$month': "$verification_date" }, | |
'day': { '$dayOfMonth': "$verification_date" } | |
}, | |
'retweets': { $last: "$retweets" }}}, | |
]).result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment