SHARE
TWEET

Untitled

a guest Jun 27th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2.     "_id" : ObjectId("5caf2c1642e3731464c2c79d"),
  3.     "requested" : [],
  4.     "roomNo" : "E0-1-09",
  5.     "capacity" : 40,
  6.     "venueType" : "LR(M)",
  7.     "seatingType" : "TB",
  8.     "slotStart" : "8:30AM",
  9.     "slotEnd" : "9:50AM",
  10.     "__v" : 0
  11. }
  12.  
  13. /* 2 */
  14. {
  15.     "_id" : ObjectId("5caf2deb4a7f5222305b55d5"),
  16.     "requested" : [],
  17.     "roomNo" : "E0-1-09",
  18.     "capacity" : 40,
  19.     "venueType" : "LR(M)",
  20.     "seatingType" : "TB",
  21.     "slotStart" : "10:00AM",
  22.     "slotEnd" : "11:20AM",
  23.     "__v" : 0
  24. }
  25.      
  26. [{ roomNo: "E0-1-09" , availability : [{slotStart : "8:30AM", slotEnd: "9:50AM"} ,
  27. {slotStart: "10:00AM", slotEnd : "11:20AM"}]
  28.      
  29. db.getDB().collection(collection).aggregate([
  30.   { $group: {_id:{roomNo: "$roomNo", availability :[{slotStart:"$slotStart", slotEnd:"$slotEnd"}]}}}
  31.      ])
  32.      
  33. [{ roomNo: "E0-1-09" , availability : [{slotStart : "8:30AM", slotEnd: "9:50AM"}]
  34. [{ roomNo: "E0-1-09" , availability : [{slotStart: "10:00AM", slotEnd : "11:20AM"}]
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