-
-
Save idaWHALE/f77b2485ceead92303d817d5a2be8740 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