Write a Query to find all the restaurant which locate in latitude value less than -65.754168
Sample Document:
{"_id" : ObjectId("6029b6e30157be18e7ee4016"),"address" : {"building" : "1007","coord" : [-73.856077,40.848447],"street" : "Morris Park Ave","zipcode" : "10462"},"borough" : "Bronx","cuisine" : "Bakery","grades" : [{"date" : ISODate("2014-03-03T00:00:00.000+0000"),"grade" : "A","score" : 2.0},{"date" : ISODate("2013-09-11T00:00:00.000+0000"),"grade" : "A","score" : 6.0},{"date" : ISODate("2013-01-24T00:00:00.000+0000"),"grade" : "A","score" : 10.0},{"date" : ISODate("2011-11-23T00:00:00.000+0000"),"grade" : "A","score" : 9.0},{"date" : ISODate("2011-03-10T00:00:00.000+0000"),"grade" : "B","score" : 14.0}],"name" : "Morris Park Bake Shop","restaurant_id" : "30075445"}
Approach
Query: Query to find the restaurant score greater than 20 and less than 30.
db.getCollection("Restaurants").find({"address.coord" : {$lt : -65.754168}});
Output:
{"_id" : ObjectId("6029bc1c0157be18e7ee401d"),"address" : {"building" : "469","coord" : [-73.961704,40.662942],"street" : "Flatbush Avenue","zipcode" : "11225"},"borough" : "Bronx","cuisine" : "Hamburgers","grades" : [{"date" : ISODate("2014-12-30T00:00:00.000+0000"),"grade" : "A","score" : 8.0},{"date" : ISODate("2014-07-01T00:00:00.000+0000"),"grade" : "B","score" : 23.0},{"date" : ISODate("2013-04-30T00:00:00.000+0000"),"grade" : "A","score" : 12.0},{"date" : ISODate("2012-05-08T00:00:00.000+0000"),"grade" : "A","score" : 12.0}],"name" : "Wendy'S","restaurant_id" : "30112340"}{"_id" : ObjectId("6029bc460157be18e7ee4021"),"address" : {"building" : "97-22","coord" : [-73.8601152,40.7311739],"street" : "63 Road","zipcode" : "11374"},"borough" : "Queens","cuisine" : "Jewish/Kosher","grades" : [{"date" : ISODate("2014-11-24T00:00:00.000+0000"),"grade" : "Z","score" : 20.0},{"date" : ISODate("2013-01-17T00:00:00.000+0000"),"grade" : "A","score" : 13.0},{"date" : ISODate("2012-08-02T00:00:00.000+0000"),"grade" : "A","score" : 13.0},{"date" : ISODate("2011-12-15T00:00:00.000+0000"),"grade" : "B","score" : 25.0}],"name" : "Tov Kosher Kitchen","restaurant_id" : "40356068"}{"_id" : ObjectId("6029bc780157be18e7ee4023"),"address" : {"building" : "8825","coord" : [-73.8803827,40.7643124],"street" : "Astoria Boulevard","zipcode" : "11369"},"borough" : "Queens","cuisine" : "American ","grades" : [{"date" : ISODate("2014-11-15T00:00:00.000+0000"),"grade" : "Z","score" : 38.0},{"date" : ISODate("2014-05-02T00:00:00.000+0000"),"grade" : "A","score" : 10.0},{"date" : ISODate("2013-03-02T00:00:00.000+0000"),"grade" : "A","score" : 7.0},{"date" : ISODate("2012-02-10T00:00:00.000+0000"),"grade" : "A","score" : 13.0}],"name" : "Brunos On The Boulevard","restaurant_id" : "40356151"}{"_id" : ObjectId("6029be0c0157be18e7ee4029"),"address" : {"building" : "1269","coord" : [-73.871194,40.6730975],"street" : "Sutter Avenue","zipcode" : "11208"},"borough" : "Brooklyn","cuisine" : "Chinese","grades" : [{"date" : ISODate("2014-09-16T00:00:00.000+0000"),"grade" : "B","score" : 21.0},{"date" : ISODate("2013-08-28T00:00:00.000+0000"),"grade" : "A","score" : 7.0},{"date" : ISODate("2013-04-02T00:00:00.000+0000"),"grade" : "C","score" : 56.0},{"date" : ISODate("2012-08-15T00:00:00.000+0000"),"grade" : "B","score" : 27.0},{"date" : ISODate("2012-03-28T00:00:00.000+0000"),"grade" : "B","score" : 27.0}],"name" : "May May Kitchen","restaurant_id" : "40358429"}
No comments:
Post a Comment