Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- db.vehicle_alerts.aggregate([
- { "$sort": { "created_at": 1 } },
- { "$group": {
- "_id": {
- "type":"$category_type",
- "time":{ "$add": [
- { "$subtract": [
- { "$subtract": [ "$created_at", new Date(0) ] },
- { "$mod": [
- { "$subtract": [ "$created_at", new Date(0) ] },
- 1000 * 60 * 5
- ]}
- ]},
- new Date(0)
- ]}
- },
- "count":{
- "$sum": 1
- }
- }}
- ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement