SHARE
TWEET

Untitled

a guest Aug 18th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. db.vehicle_alerts.aggregate([
  2.     { "$sort": { "created_at": 1 } },
  3.     { "$group": {
  4.         "_id": {
  5.             "type":"$category_type",
  6.             "time":{ "$add": [
  7.                 { "$subtract": [
  8.                     { "$subtract": [ "$created_at", new Date(0) ] },
  9.                     { "$mod": [
  10.                         { "$subtract": [ "$created_at", new Date(0) ] },
  11.                         1000 * 60 * 5
  12.                     ]}
  13.                 ]},
  14.                 new Date(0)
  15.             ]}
  16.         },
  17.         "count":{
  18.             "$sum": 1        
  19.         }
  20.     }}
  21. ]);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top