Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. db.restaurants.aggregate([
  2. {$lookup:
  3. {
  4. from: "demographics",
  5. localField: "address.zipcode",
  6. foreignField: "JURISDICTION NAME",
  7. as: "sub_zipcode"
  8. }
  9. },
  10. {
  11. $unwind : "$sub_zipcode"
  12. },
  13. {$match:
  14. {"sub_zipcode.PERCENT FEMALE": {$eq: "0.5"}}
  15. },
  16. {$lookup:
  17. {
  18. from: "inspections",
  19. localField: "name",
  20. foreignField: "NAME",
  21. as: "sub_inspections"
  22. }
  23. },
  24. {
  25. $unwind : "$sub_inspections"
  26. },
  27. {$match:
  28. {"sub_inspections.VIOLATION CODE": {$eq: "04L"}}
  29. }
  30. ]).pretty()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement