SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. db.inspections.aggregate([
  2.     {$match:
  3.         {"VIOLATION CODE":"04L"}
  4.     },
  5.     {$out: "rests_with_mice"}
  6. ])
  7.  
  8. db.demographics.aggregate([
  9.     {$match:
  10.         {"PERCENT FEMALE":"0.5"}
  11.     },
  12.     {$out: "zips_with_split_gender"}
  13. ])
  14.  
  15. db.restaurants.aggregate([
  16.     {$lookup:
  17.         {
  18.             from: "demographics",
  19.             localField: "address.zipcode",
  20.             foreignField: "JURISDICTION NAME",
  21.             as: "sub_zipcode"
  22.         }
  23.     },
  24.     {$match:
  25.         {"sub_zipcode.PERCENT FEMALE": {$eq: "0.5"}}
  26.     },
  27.     {$lookup:
  28.         {
  29.             from: "rests_with_mice",
  30.             localField: "name",
  31.             foreignField: "NAME",
  32.             as: "sub_rests_with_mice"
  33.         }
  34.     },
  35.     {$project:
  36.         {"_id":0, "borough":1, "name":1, restaurant_id":1}
  37.     },
  38.     {$sort:
  39.         {"_id":0, "borough":1, "name":1}
  40.     }
  41.     {$out: "please work"}
  42. ])
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