Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var startDate = new ISODate("2017-10-01")
- var endDate = new ISODate("2017-10-31")
- var startUnixTime = startDate.getTime() /1000 // convert date to time
- var endUnixTime = endDate.getTime() /1000 // convert date to time
- db.PermanentBookings.aggregate([
- { $match: {
- $and:[
- { init_time: { $gte: startUnixTime, $lte: endUnixTime }} ,
- { city:"Madrid" }
- ]
- }
- } ,
- { $project:{
- duration: {
- $subtract: ["$final_time", "$init_time"] },
- week: { $week: "$init_date" } }
- }
- ])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement