Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1.  
  2.  
  3.  
  4. 1. where the restaurant is not listed in the inspection data set.
  5.  
  6.  
  7.  
  8. db.restaurants.aggregate([
  9. {$lookup:
  10. {
  11. from: "inspections",
  12. localField: "",
  13. foriegnField: "",
  14. as: "restaurants_with_inspections"
  15. }
  16. },
  17. {$match:
  18. {"borough":"Manhattan","address.street":"Madison Avenue"}
  19. },
  20. {$sort:
  21. {"name":1}
  22. },
  23. {$project:
  24. {"_id":0, "restaurant_id":1, "name":1, "address.street":1}
  25. }
  26. ]).pretty()
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34. 2. for restaurants with evidence of mice or live mice (use violation code = ā€œ04Lā€)
  35.  
  36. in zipcodes that have a fifty-fifty split by gender (use percent female = ā€œ0.5ā€).
  37.  
  38.  
  39. db.restaurants.aggregate([
  40. {$sort:
  41. {"borough":1, "name":1}
  42. },
  43. {$project:
  44. {"_id":0, "borough":1, "name":1, "restaurant_id":1}
  45. }
  46. ]).pretty()
  47.  
  48.  
  49.  
  50.  
  51.  
  52. 3. write our own data demand/query
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement