daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Nov 14th, 2018 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var startDate = new ISODate("2017-10-01")
  2. var endDate = new ISODate("2017-10-31")
  3. var startUnixTime = startDate.getTime() /1000 // convert date to time
  4. var endUnixTime = endDate.getTime() /1000 // convert date to time
  5.  
  6. db.PermanentBookings.aggregate([
  7.   {  $match: {
  8.         $and:[
  9.             { init_time: { $gte: startUnixTime, $lte: endUnixTime }} ,
  10.             { city:"Madrid" }
  11.         ]
  12.      }
  13.    } ,
  14.    
  15.    { $project:{
  16.        duration: {
  17.             $subtract: ["$final_time", "$init_time"] },
  18.              
  19.        week: { $week: "$init_date" } }
  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