Skip to content

Instantly share code, notes, and snippets.

@ElenaG518
Created August 31, 2018 17:43
Show Gist options
  • Save ElenaG518/6a82a362793da99254e3a727cc5a680b to your computer and use it in GitHub Desktop.
Save ElenaG518/6a82a362793da99254e3a727cc5a680b to your computer and use it in GitHub Desktop.
mongo basic drills
Last login: Fri Aug 31 09:04:17 on ttys000
Elenas-MacBook-Air:~ pachibook$ mongoimport --db tempTestDb --collection restaurants --drop --file ~/Projects/learn-mongo/primer-dataset.json
2018-08-31T09:06:48.822-0700 connected to: localhost
2018-08-31T09:06:48.824-0700 dropping: tempTestDb.restaurants
2018-08-31T09:06:49.137-0700 imported 3950 documents
Elenas-MacBook-Air:~ pachibook$ mongo
MongoDB shell version v4.0.1
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 4.0.1
Server has startup warnings:
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten]
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten]
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten]
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten]
2018-08-31T09:04:29.324-0700 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
tempTestDb 0.001GB
> db
test
> db
test
> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
tempTestDb 0.001GB
> db
test
> use tempTestDb
switched to db tempTestDb
> db.getCollectionNames()
[ "restaurants" ]
> db.restaurants.find({})
{ "_id" : ObjectId("59074c7c057aaffaafb0da64"), "address" : { "building" : "2911", "coord" : [ -73.982241, 40.576366 ], "street" : "West 15 Street", "zipcode" : "11224" }, "borough" : "Brooklyn", "cuisine" : "Italian", "grades" : [ { "date" : ISODate("2014-12-18T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2014-05-15T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-06-12T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-02-06T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Gargiulo's Restaurant", "restaurant_id" : "40365784" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da57"), "address" : { "building" : "72", "coord" : [ -73.92506, 40.8275556 ], "street" : "East 161 Street", "zipcode" : "10451" }, "borough" : "Bronx", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-04-15T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-11-14T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2013-07-29T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2012-12-31T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2012-05-30T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-09T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2011-08-15T00:00:00Z"), "grade" : "C", "score" : 37 } ], "name" : "Yankee Tavern", "restaurant_id" : "40365499" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da6d"), "address" : { "building" : "21", "coord" : [ -73.9990337, 40.7143954 ], "street" : "Mott Street", "zipcode" : "10013" }, "borough" : "Manhattan", "cuisine" : "Chinese", "grades" : [ { "date" : ISODate("2014-07-28T00:00:00Z"), "grade" : "B", "score" : 27 }, { "date" : ISODate("2013-11-19T00:00:00Z"), "grade" : "B", "score" : 20 }, { "date" : ISODate("2013-04-30T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-10-16T00:00:00Z"), "grade" : "B", "score" : 24 }, { "date" : ISODate("2012-05-07T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Hop Kee Restaurant", "restaurant_id" : "40365942" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da6c"), "address" : { "building" : "25541", "coord" : [ -73.70902579999999, 40.7276012 ], "street" : "Jamaica Avenue", "zipcode" : "11001" }, "borough" : "Queens", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-01-16T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2013-06-20T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-10-04T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-10T00:00:00Z"), "grade" : "B", "score" : 20 }, { "date" : ISODate("2011-06-23T00:00:00Z"), "grade" : "B", "score" : 21 } ], "name" : "Nancy's Fire Side", "restaurant_id" : "40365938" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da5e"), "address" : { "building" : "6322", "coord" : [ -73.9896898, 40.6199526 ], "street" : "18 Avenue", "zipcode" : "11204" }, "borough" : "Brooklyn", "cuisine" : "Pizza", "grades" : [ { "date" : ISODate("2014-12-30T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2014-05-15T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-10-29T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-10-06T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-03-29T00:00:00Z"), "grade" : "A", "score" : 13 } ], "name" : "J&V Famous Pizza", "restaurant_id" : "40365632" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da5a"), "address" : { "building" : "229", "coord" : [ -73.9590059, 40.7090147 ], "street" : "Havemeyer Street", "zipcode" : "11211" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-08-18T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2014-01-08T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-05-20T00:00:00Z"), "grade" : "B", "score" : 21 }, { "date" : ISODate("2012-09-20T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2011-09-22T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Reben Luncheonette", "restaurant_id" : "40365546" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da60"), "address" : { "building" : "326", "coord" : [ -73.989131, 40.760039 ], "street" : "West 46 Street", "zipcode" : "10036" }, "borough" : "Manhattan", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-09-10T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-09-25T00:00:00Z"), "grade" : "A", "score" : 6 }, { "date" : ISODate("2012-09-11T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2012-04-19T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2011-10-26T00:00:00Z"), "grade" : "A", "score" : 13 } ], "name" : "Joe Allen Restaurant", "restaurant_id" : "40365644" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da79"), "address" : { "building" : "13558", "coord" : [ -73.8216767, 40.6689548 ], "street" : "Lefferts Boulevard", "zipcode" : "11420" }, "borough" : "Queens", "cuisine" : "Italian", "grades" : [ { "date" : ISODate("2014-06-20T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-06-07T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-06-28T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-13T00:00:00Z"), "grade" : "C", "score" : 28 } ], "name" : "Don Peppe", "restaurant_id" : "40366230" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da72"), "address" : { "building" : "416", "coord" : [ -73.98586209999999, 40.67017250000001 ], "street" : "5 Avenue", "zipcode" : "11215" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-12-04T00:00:00Z"), "grade" : "B", "score" : 22 }, { "date" : ISODate("2014-04-19T00:00:00Z"), "grade" : "A", "score" : 3 }, { "date" : ISODate("2013-02-14T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-12T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Fifth Avenue Bingo", "restaurant_id" : "40366109" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da7b"), "address" : { "building" : "1611", "coord" : [ -73.955074, 40.599217 ], "street" : "Avenue U", "zipcode" : "11229" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-07-02T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-07-10T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-02-13T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2012-08-16T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-03-29T00:00:00Z"), "grade" : "B", "score" : 24 } ], "name" : "Three Star Restaurant", "restaurant_id" : "40366361" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da75"), "address" : { "building" : "146", "coord" : [ -73.9736776, 40.7535755 ], "street" : "East 46 Street", "zipcode" : "10017" }, "borough" : "Manhattan", "cuisine" : "Italian", "grades" : [ { "date" : ISODate("2014-03-11T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-07-31T00:00:00Z"), "grade" : "C", "score" : 53 }, { "date" : ISODate("2012-12-19T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-06-04T00:00:00Z"), "grade" : "C", "score" : 45 }, { "date" : ISODate("2012-01-18T00:00:00Z"), "grade" : "C", "score" : 34 }, { "date" : ISODate("2011-09-28T00:00:00Z"), "grade" : "B", "score" : 18 }, { "date" : ISODate("2011-05-24T00:00:00Z"), "grade" : "C", "score" : 52 } ], "name" : "Nanni Restaurant", "restaurant_id" : "40366157" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da7f"), "address" : { "building" : "6828", "coord" : [ -73.8204154, 40.7242443 ], "street" : "Main Street", "zipcode" : "11367" }, "borough" : "Queens", "cuisine" : "Jewish/Kosher", "grades" : [ { "date" : ISODate("2014-09-24T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2014-03-10T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-05-31T00:00:00Z"), "grade" : "B", "score" : 26 }, { "date" : ISODate("2012-05-10T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2011-11-03T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Naomi Kosher Pizza", "restaurant_id" : "40366425" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da82"), "address" : { "building" : "3432", "coord" : [ -73.9420751, 40.6002442 ], "street" : "Nostrand Avenue", "zipcode" : "11229" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-10-30T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-10-16T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-06-04T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-06-04T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-12-22T00:00:00Z"), "grade" : "A", "score" : 5 } ], "name" : "Brennan & Carr", "restaurant_id" : "40366487" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da8d"), "address" : { "building" : "84", "coord" : [ -73.9300062, 40.5943553 ], "street" : "Ebony Court", "zipcode" : "11229" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-05-21T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-05-21T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-06-06T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-02-01T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Tamaqua", "restaurant_id" : "40366742" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da87"), "address" : { "building" : "71-24", "coord" : [ -73.8221418, 40.7272376 ], "street" : "Main Street", "zipcode" : "11367" }, "borough" : "Queens", "cuisine" : "Jewish/Kosher", "grades" : [ { "date" : ISODate("2014-05-07T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-09-04T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2013-03-21T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-05-23T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-11-01T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Shimons Kosher Pizza", "restaurant_id" : "40366586" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da88"), "address" : { "building" : "225", "coord" : [ -74.0027865, 40.7340505 ], "street" : "West 4 Street", "zipcode" : "10014" }, "borough" : "Manhattan", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-12-16T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-12-09T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-06-19T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2012-06-29T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "The Riviera Cafe", "restaurant_id" : "40366643" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da9a"), "address" : { "building" : "459", "coord" : [ -73.979839, 40.739796 ], "street" : "2 Avenue", "zipcode" : "10010" }, "borough" : "Manhattan", "cuisine" : "Mexican", "grades" : [ { "date" : ISODate("2014-10-30T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2013-11-07T00:00:00Z"), "grade" : "A", "score" : 2 }, { "date" : ISODate("2012-10-23T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2012-05-07T00:00:00Z"), "grade" : "A", "score" : 10 } ], "name" : "Mexico Lindo Restaurant", "restaurant_id" : "40367038" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da96"), "address" : { "building" : "617", "coord" : [ -73.9681178, 40.678776 ], "street" : "Vanderbilt Avenue", "zipcode" : "11238" }, "borough" : "Brooklyn", "cuisine" : "Soul Food", "grades" : [ { "date" : ISODate("2014-08-28T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2014-03-27T00:00:00Z"), "grade" : "C", "score" : 2 }, { "date" : ISODate("2013-07-17T00:00:00Z"), "grade" : "B", "score" : 25 }, { "date" : ISODate("2012-05-17T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2011-12-21T00:00:00Z"), "grade" : "A", "score" : 8 } ], "name" : "Mitchell's Restaurant", "restaurant_id" : "40366961" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da67"), "address" : { "building" : "45-15", "coord" : [ -73.91427200000001, 40.7569379 ], "street" : "Broadway", "zipcode" : "11103" }, "borough" : "Queens", "cuisine" : "American", "grades" : [ { "date" : ISODate("2013-12-04T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-05-02T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2012-03-15T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2011-07-12T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2011-02-16T00:00:00Z"), "grade" : "A", "score" : 7 } ], "name" : "Lavelle's Admiral's Club", "restaurant_id" : "40365844" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da9d"), "address" : { "building" : "421", "coord" : [ -73.99682299999999, 40.753182 ], "street" : "9 Avenue", "zipcode" : "10001" }, "borough" : "Manhattan", "cuisine" : "Irish", "grades" : [ { "date" : ISODate("2014-07-01T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2014-01-28T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2012-12-12T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-12-28T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-09-02T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Twins Pub", "restaurant_id" : "40367179" }
Type "it" for more
> db.restaurants.find({}, {name: 1}).
...
...
> db.restaurants.find({}).
... sort({name: 1}).
... limit(10);
{ "_id" : ObjectId("59074c7c057aaffaafb0e20b"), "address" : { "building" : "10016", "coord" : [ -73.8216636, 40.5838155 ], "street" : "Rockaway Beach Boulevard", "zipcode" : "11694" }, "borough" : "Queens", "cuisine" : "Delicatessen", "grades" : [ { "date" : ISODate("2014-01-28T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-08-20T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-03-19T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2012-03-06T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2011-03-01T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "101 Deli", "restaurant_id" : "40591271" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f8d8"), "address" : { "building" : "192", "coord" : [ -73.985501, 40.731012 ], "street" : "2 Avenue", "zipcode" : "10003" }, "borough" : "Manhattan", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-06-24T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-10-09T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-04-02T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2012-07-03T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2011-12-13T00:00:00Z"), "grade" : "A", "score" : 5 } ], "name" : "12 Street Ale House", "restaurant_id" : "41299113" }
{ "_id" : ObjectId("59074c7c057aaffaafb116cc"), "address" : { "building" : "120", "coord" : [ -74.0757603, 40.6394573 ], "street" : "Bay Street", "zipcode" : "10301" }, "borough" : "Staten Island", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-10-07T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2014-04-28T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-02-23T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2012-07-16T00:00:00Z"), "grade" : "A", "score" : 7 } ], "name" : "120 Bay Cafe", "restaurant_id" : "41646201" }
{ "_id" : ObjectId("59074c7c057aaffaafb1063a"), "address" : { "building" : "3379", "coord" : [ -73.9544847, 40.8214312 ], "street" : "Broadway", "zipcode" : "10031" }, "borough" : "Manhattan", "cuisine" : "Steak", "grades" : [ { "date" : ISODate("2014-09-30T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2014-04-03T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-01-25T00:00:00Z"), "grade" : "A", "score" : 2 }, { "date" : ISODate("2012-09-11T00:00:00Z"), "grade" : "C", "score" : 0 } ], "name" : "137 Bar & Grill", "restaurant_id" : "41478576" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f22e"), "address" : { "building" : "169", "coord" : [ -73.9897597, 40.7139068 ], "street" : "East Broadway", "zipcode" : "10002" }, "borough" : "Manhattan", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-11-24T00:00:00Z"), "grade" : "B", "score" : 22 }, { "date" : ISODate("2014-05-06T00:00:00Z"), "grade" : "B", "score" : 21 }, { "date" : ISODate("2013-07-30T00:00:00Z"), "grade" : "C", "score" : 45 }, { "date" : ISODate("2012-07-05T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2012-02-09T00:00:00Z"), "grade" : "A", "score" : 10 } ], "name" : "169 Bar", "restaurant_id" : "41171181" }
{ "_id" : ObjectId("59074c7c057aaffaafb10338"), "address" : { "building" : "1818", "coord" : [ -73.952862, 40.598966 ], "street" : "Avenue U", "zipcode" : "11229" }, "borough" : "Brooklyn", "cuisine" : "Chinese", "grades" : [ { "date" : ISODate("2014-10-23T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2014-04-29T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-08-28T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-03-13T00:00:00Z"), "grade" : "B", "score" : 20 }, { "date" : ISODate("2012-06-25T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-01-12T00:00:00Z"), "grade" : "B", "score" : 23 } ], "name" : "1818 Seafood Restaurant", "restaurant_id" : "41445737" }
{ "_id" : ObjectId("59074c7c057aaffaafb119fb"), "address" : { "building" : "75", "coord" : [ -74.0764379, 40.6453515 ], "street" : "Richmond Terrace", "zipcode" : "10301" }, "borough" : "Staten Island", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-06-21T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2013-08-21T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-06-20T00:00:00Z"), "grade" : "A", "score" : 10 } ], "name" : "1St Base Concession Stand", "restaurant_id" : "41673023" }
{ "_id" : ObjectId("59074c7c057aaffaafb106a2"), "address" : { "building" : "601", "coord" : [ -92.72874859999999, 41.746174 ], "street" : "6 Avenue", "zipcode" : "10011" }, "borough" : "Manhattan", "cuisine" : "Pizza", "grades" : [ { "date" : ISODate("2014-04-14T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-11-16T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-07-17T00:00:00Z"), "grade" : "B", "score" : 17 }, { "date" : ISODate("2013-01-24T00:00:00Z"), "grade" : "B", "score" : 23 }, { "date" : ISODate("2012-07-13T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2012-02-06T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2011-10-26T00:00:00Z"), "grade" : "B", "score" : 26 }, { "date" : ISODate("2011-05-11T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "2 Bros Pizza", "restaurant_id" : "41482609" }
{ "_id" : ObjectId("59074c7c057aaffaafb10c04"), "address" : { "building" : "211", "coord" : [ -73.986215, 40.7330791 ], "street" : "East 14 Street", "zipcode" : "10003" }, "borough" : "Manhattan", "cuisine" : "Tex-Mex", "grades" : [ { "date" : ISODate("2014-09-19T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2014-03-17T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-08-14T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-07-23T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2012-02-13T00:00:00Z"), "grade" : "A", "score" : 4 } ], "name" : "211 New Taco Grill", "restaurant_id" : "41554626" }
{ "_id" : ObjectId("59074c7c057aaffaafb10acb"), "address" : { "building" : "168", "coord" : [ -73.9798836, 40.7272748 ], "street" : "Avenue B", "zipcode" : "10009" }, "borough" : "Manhattan", "cuisine" : "French", "grades" : [ { "date" : ISODate("2014-07-01T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-11-12T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-04-10T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-02-02T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "26 Seats", "restaurant_id" : "41541665" }
> db.restaurants.find({}, {name: 1}). sort({name: 1}). limit(10);
{ "_id" : ObjectId("59074c7c057aaffaafb0e20b"), "name" : "101 Deli" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f8d8"), "name" : "12 Street Ale House" }
{ "_id" : ObjectId("59074c7c057aaffaafb116cc"), "name" : "120 Bay Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb1063a"), "name" : "137 Bar & Grill" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f22e"), "name" : "169 Bar" }
{ "_id" : ObjectId("59074c7c057aaffaafb10338"), "name" : "1818 Seafood Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb119fb"), "name" : "1St Base Concession Stand" }
{ "_id" : ObjectId("59074c7c057aaffaafb106a2"), "name" : "2 Bros Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb10c04"), "name" : "211 New Taco Grill" }
{ "_id" : ObjectId("59074c7c057aaffaafb10acb"), "name" : "26 Seats" }
> db.restaurants.find({})._id
> db.restaurants.find({}, {_id: 1})
{ "_id" : ObjectId("59074c7c057aaffaafb0da64") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da57") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da6d") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da6c") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da5e") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da5a") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da60") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da79") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da72") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da7b") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da75") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da7f") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da82") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da8d") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da87") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da88") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da9a") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da96") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da67") }
{ "_id" : ObjectId("59074c7c057aaffaafb0da9d") }
Type "it" for more
> db.restaurants.findOne({})._id
ObjectId("59074c7c057aaffaafb0da64")
> db.restaurants.find({borough: "Queens"}
...
...
> db.restaurants.find({borough: "Queens"})
{ "_id" : ObjectId("59074c7c057aaffaafb0da6c"), "address" : { "building" : "25541", "coord" : [ -73.70902579999999, 40.7276012 ], "street" : "Jamaica Avenue", "zipcode" : "11001" }, "borough" : "Queens", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-01-16T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2013-06-20T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-10-04T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-10T00:00:00Z"), "grade" : "B", "score" : 20 }, { "date" : ISODate("2011-06-23T00:00:00Z"), "grade" : "B", "score" : 21 } ], "name" : "Nancy's Fire Side", "restaurant_id" : "40365938" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da79"), "address" : { "building" : "13558", "coord" : [ -73.8216767, 40.6689548 ], "street" : "Lefferts Boulevard", "zipcode" : "11420" }, "borough" : "Queens", "cuisine" : "Italian", "grades" : [ { "date" : ISODate("2014-06-20T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-06-07T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-06-28T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-13T00:00:00Z"), "grade" : "C", "score" : 28 } ], "name" : "Don Peppe", "restaurant_id" : "40366230" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da7f"), "address" : { "building" : "6828", "coord" : [ -73.8204154, 40.7242443 ], "street" : "Main Street", "zipcode" : "11367" }, "borough" : "Queens", "cuisine" : "Jewish/Kosher", "grades" : [ { "date" : ISODate("2014-09-24T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2014-03-10T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-05-31T00:00:00Z"), "grade" : "B", "score" : 26 }, { "date" : ISODate("2012-05-10T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2011-11-03T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Naomi Kosher Pizza", "restaurant_id" : "40366425" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da87"), "address" : { "building" : "71-24", "coord" : [ -73.8221418, 40.7272376 ], "street" : "Main Street", "zipcode" : "11367" }, "borough" : "Queens", "cuisine" : "Jewish/Kosher", "grades" : [ { "date" : ISODate("2014-05-07T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-09-04T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2013-03-21T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-05-23T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-11-01T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Shimons Kosher Pizza", "restaurant_id" : "40366586" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da67"), "address" : { "building" : "45-15", "coord" : [ -73.91427200000001, 40.7569379 ], "street" : "Broadway", "zipcode" : "11103" }, "borough" : "Queens", "cuisine" : "American", "grades" : [ { "date" : ISODate("2013-12-04T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-05-02T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2012-03-15T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2011-07-12T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2011-02-16T00:00:00Z"), "grade" : "A", "score" : 7 } ], "name" : "Lavelle's Admiral's Club", "restaurant_id" : "40365844" }
{ "_id" : ObjectId("59074c7c057aaffaafb0daa3"), "address" : { "building" : "21249", "coord" : [ -73.7775242, 40.778475 ], "street" : "26 Avenue", "zipcode" : "11360" }, "borough" : "Queens", "cuisine" : "Pizza/Italian", "grades" : [ { "date" : ISODate("2015-01-06T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2014-01-21T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-01-29T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-05-16T00:00:00Z"), "grade" : "B", "score" : 25 } ], "name" : "Jack's Pizza & Pasta", "restaurant_id" : "40367278" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dab8"), "address" : { "building" : "81-28", "coord" : [ -73.8305269, 40.7089494 ], "street" : "Lefferts Boulevard", "zipcode" : "11415" }, "borough" : "Queens", "cuisine" : "Pizza", "grades" : [ { "date" : ISODate("2014-12-03T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2014-06-25T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2013-10-22T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2012-09-12T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2012-04-19T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Dani Pizza And Restaurant", "restaurant_id" : "40367789" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dade"), "address" : { "building" : "18925", "coord" : [ -73.7796156, 40.7298006 ], "street" : "Union Turnpike", "zipcode" : "11366" }, "borough" : "Queens", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-09-25T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-07-24T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-08-13T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2012-04-02T00:00:00Z"), "grade" : "A", "score" : 2 }, { "date" : ISODate("2011-10-24T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "P.J.' S", "restaurant_id" : "40368809" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dae1"), "address" : { "building" : "7147", "coord" : [ -73.814835, 40.7288261 ], "street" : "Kissena Boulevard", "zipcode" : "11367" }, "borough" : "Queens", "cuisine" : "Pizza/Italian", "grades" : [ { "date" : ISODate("2014-09-24T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2014-05-13T00:00:00Z"), "grade" : "B", "score" : 19 }, { "date" : ISODate("2013-04-16T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2012-10-18T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2012-05-23T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2011-11-03T00:00:00Z"), "grade" : "A", "score" : 6 } ], "name" : "Valentino's Pizza", "restaurant_id" : "40369012" }
{ "_id" : ObjectId("59074c7c057aaffaafb0daeb"), "address" : { "building" : "3005", "coord" : [ -73.8335566, 40.7703224 ], "street" : "Whitestone Expressway", "zipcode" : "11354" }, "borough" : "Queens", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-09-18T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2014-02-18T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-06-08T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-09-15T00:00:00Z"), "grade" : "B", "score" : 26 }, { "date" : ISODate("2011-12-07T00:00:00Z"), "grade" : "B", "score" : 16 } ], "name" : "Whitestone Lanes", "restaurant_id" : "40369213" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dab5"), "address" : { "building" : "16103", "coord" : [ -73.83856999999999, 40.655669 ], "street" : "Crossbay Boulevard", "zipcode" : "11414" }, "borough" : "Queens", "cuisine" : "Seafood", "grades" : [ { "date" : ISODate("2014-10-29T00:00:00Z"), "grade" : "B", "score" : 16 }, { "date" : ISODate("2014-03-26T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-08-22T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-04-25T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2011-11-03T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Lenny's Clam Bar", "restaurant_id" : "40367749" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db0f"), "address" : { "building" : "83-18", "coord" : [ -73.807954, 40.715159 ], "street" : "Parsons Boulevard", "zipcode" : "11432" }, "borough" : "Queens", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-12-31T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2014-03-18T00:00:00Z"), "grade" : "B", "score" : 21 }, { "date" : ISODate("2013-09-25T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-04-10T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-08-30T00:00:00Z"), "grade" : "A", "score" : 13 } ], "name" : "The Dart Inn", "restaurant_id" : "40369983" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db1d"), "address" : { "building" : "49-20", "coord" : [ -73.90725640000001, 40.7601082 ], "street" : "30 Avenue", "zipcode" : "11377" }, "borough" : "Queens", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-02-04T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-01-16T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-01-25T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2011-10-13T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2011-05-23T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Pat's Stationary", "restaurant_id" : "40370449" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db06"), "address" : { "building" : "61-32", "coord" : [ -73.7566136, 40.7483444 ], "street" : "Springfield Boulevard", "zipcode" : "11364" }, "borough" : "Queens", "cuisine" : "Pizza/Italian", "grades" : [ { "date" : ISODate("2014-09-25T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2014-03-13T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-07-15T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-02-13T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-06-14T00:00:00Z"), "grade" : "B", "score" : 17 }, { "date" : ISODate("2011-11-02T00:00:00Z"), "grade" : "B", "score" : 21 } ], "name" : "Gino's Pizzeria", "restaurant_id" : "40369849" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db45"), "address" : { "building" : "3941", "coord" : [ -73.9245566, 40.7441786 ], "street" : "Queens Boulevard", "zipcode" : "11104" }, "borough" : "Queens", "cuisine" : "Italian", "grades" : [ { "date" : ISODate("2014-05-06T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-10-29T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-04-18T00:00:00Z"), "grade" : "B", "score" : 27 }, { "date" : ISODate("2012-03-06T00:00:00Z"), "grade" : "A", "score" : 13 } ], "name" : "Dazies Restaurant", "restaurant_id" : "40372426" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db3c"), "address" : { "building" : "19652", "coord" : [ -73.78421000000002, 40.7577566 ], "street" : "Northern Blvd", "zipcode" : "11358" }, "borough" : "Queens", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-06-24T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-10-17T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-04-24T00:00:00Z"), "grade" : "C", "score" : 42 }, { "date" : ISODate("2012-10-18T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-05-24T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2011-12-30T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "North Shore Diner", "restaurant_id" : "40371988" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db4e"), "address" : { "building" : "917", "coord" : [ -73.8128627, 40.7931101 ], "street" : "Clintonville Street", "zipcode" : "11357" }, "borough" : "Queens", "cuisine" : "Italian", "grades" : [ { "date" : ISODate("2014-06-25T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-05-21T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-10-17T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-03-10T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2011-09-24T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Clinton Restaurant", "restaurant_id" : "40372694" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db88"), "address" : { "building" : "21532", "coord" : [ -73.74878939999999, 40.7271425 ], "street" : "Hillside Avenue", "zipcode" : "11427" }, "borough" : "Queens", "cuisine" : "Pizza", "grades" : [ { "date" : ISODate("2015-01-10T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-12-12T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-11-13T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Neron's Pizza", "restaurant_id" : "40375899" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dbb1"), "address" : { "building" : "107-08", "coord" : [ -73.8454959, 40.7207511 ], "street" : "70 Road", "zipcode" : "11375" }, "borough" : "Queens", "cuisine" : "Japanese", "grades" : [ { "date" : ISODate("2014-06-25T00:00:00Z"), "grade" : "A", "score" : 6 }, { "date" : ISODate("2014-01-09T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-05-02T00:00:00Z"), "grade" : "A", "score" : 2 }, { "date" : ISODate("2012-09-11T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-02-13T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2011-09-15T00:00:00Z"), "grade" : "B", "score" : 27 } ], "name" : "Narita Japanese Restaurant", "restaurant_id" : "40378190" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dbb7"), "address" : { "building" : "9310", "coord" : [ -73.84938439999999, 40.688197 ], "street" : "Woodhaven Boulevard", "zipcode" : "11421" }, "borough" : "Queens", "cuisine" : "American", "grades" : [ { "date" : ISODate("2013-12-27T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-06-07T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2012-04-12T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2011-10-14T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Port O' Calls", "restaurant_id" : "40378534" }
Type "it" for more
> db.restaurants.find({borough: "Queens"}, {name: 1})
{ "_id" : ObjectId("59074c7c057aaffaafb0da6c"), "name" : "Nancy's Fire Side" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da79"), "name" : "Don Peppe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da7f"), "name" : "Naomi Kosher Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da87"), "name" : "Shimons Kosher Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da67"), "name" : "Lavelle's Admiral's Club" }
{ "_id" : ObjectId("59074c7c057aaffaafb0daa3"), "name" : "Jack's Pizza & Pasta" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dab8"), "name" : "Dani Pizza And Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dade"), "name" : "P.J.' S" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dae1"), "name" : "Valentino's Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0daeb"), "name" : "Whitestone Lanes" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dab5"), "name" : "Lenny's Clam Bar" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db0f"), "name" : "The Dart Inn" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db1d"), "name" : "Pat's Stationary" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db06"), "name" : "Gino's Pizzeria" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db45"), "name" : "Dazies Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db3c"), "name" : "North Shore Diner" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db4e"), "name" : "Clinton Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db88"), "name" : "Neron's Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dbb1"), "name" : "Narita Japanese Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dbb7"), "name" : "Port O' Calls" }
Type "it" for more
> db.restaurants.find({}).count
function (applySkipLimit) {
var cmd = this._convertToCountCmd(applySkipLimit);
var res = this._db.runReadCommand(cmd);
if (res && res.n != null)
return res.n;
throw _getErrorWithCode(res, "count failed: " + tojson(res));
}
> db.restaurants.find({}).count()
3950
> db.restaurants.find({document.address.zipcode: '11206'})
2018-08-31T09:26:36.419-0700 E QUERY [js] SyntaxError: missing : after property id @(shell):1:29
> db.restaurants.find({address: {zipcode: '11206'}})
> db.restaurants.find( { address: { zipcode: "11206" } } )
> db.restaurants.find( { "address.zipcode": "11206" } )
{ "_id" : ObjectId("59074c7c057aaffaafb0e874"), "address" : { "building" : "241", "coord" : [ -73.9398247, 40.7076864 ], "street" : "Bushwick Avenue", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Pizza/Italian", "grades" : [ { "date" : ISODate("2014-11-06T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2013-11-18T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-06-26T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-12-17T00:00:00Z"), "grade" : "C", "score" : 40 } ], "name" : "Danny's Pizzeria & Cafe", "restaurant_id" : "40887949" }
{ "_id" : ObjectId("59074c7c057aaffaafb0ee95"), "address" : { "building" : "712", "coord" : [ -73.943236, 40.701137 ], "street" : "Broadway", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-10-20T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2014-05-06T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-11-20T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-06-18T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-01-29T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-07-25T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-03-01T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Bed Stuy Diner", "restaurant_id" : "41081103" }
{ "_id" : ObjectId("59074c7c057aaffaafb0eef4"), "address" : { "building" : "223", "coord" : [ -73.939621, 40.708255 ], "street" : "Bushwick Avenue", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Mexican", "grades" : [ { "date" : ISODate("2014-04-04T00:00:00Z"), "grade" : "A", "score" : 2 }, { "date" : ISODate("2013-10-21T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-10-17T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-10-13T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Jessi Bakery", "restaurant_id" : "41090020" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f0b3"), "address" : { "building" : "801", "coord" : [ -73.9400543, 40.6998615 ], "street" : "Broadway", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Café/Coffee/Tea", "grades" : [ { "date" : ISODate("2014-09-30T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2014-05-06T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-04-18T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-04-30T00:00:00Z"), "grade" : "A", "score" : 6 }, { "date" : ISODate("2011-12-28T00:00:00Z"), "grade" : "A", "score" : 5 } ], "name" : "Jk & Sons Coffee Shop", "restaurant_id" : "41139783" }
{ "_id" : ObjectId("59074c7c057aaffaafb0fd79"), "address" : { "building" : "279", "coord" : [ -73.9394658, 40.7065248 ], "street" : "Bushwick Avenue", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Thai", "grades" : [ { "date" : ISODate("2014-06-28T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2013-06-27T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-12-18T00:00:00Z"), "grade" : "B", "score" : 21 } ], "name" : "Note Thai", "restaurant_id" : "41373868" }
{ "_id" : ObjectId("59074c7c057aaffaafb105d5"), "address" : { "building" : "830", "coord" : [ -73.939466, 40.6990399 ], "street" : "Broadway", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Mexican", "grades" : [ { "date" : ISODate("2014-09-11T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2014-04-24T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-10-21T00:00:00Z"), "grade" : "C", "score" : 41 }, { "date" : ISODate("2012-08-30T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2011-09-20T00:00:00Z"), "grade" : "A", "score" : 13 } ], "name" : "Taqueria La Placita Puebla", "restaurant_id" : "41474967" }
{ "_id" : ObjectId("59074c7c057aaffaafb10887"), "address" : { "building" : "202", "coord" : [ -73.947064, 40.7109698 ], "street" : "Leonard Street", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Mexican", "grades" : [ { "date" : ISODate("2014-04-04T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-10-21T00:00:00Z"), "grade" : "B", "score" : 27 }, { "date" : ISODate("2013-05-14T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2012-09-24T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-09-15T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-05-06T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Haab", "restaurant_id" : "41508916" }
{ "_id" : ObjectId("59074c7c057aaffaafb109f6"), "address" : { "building" : "941", "coord" : [ -73.9353977, 40.6972074 ], "street" : "Broadway", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Spanish", "grades" : [ { "date" : ISODate("2015-01-16T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2014-01-09T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-07-31T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-02-28T00:00:00Z"), "grade" : "B", "score" : 19 }, { "date" : ISODate("2012-08-20T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2012-03-23T00:00:00Z"), "grade" : "B", "score" : 19 } ], "name" : "Loma Restaurant Coffee Shop", "restaurant_id" : "41531073" }
{ "_id" : ObjectId("59074c7c057aaffaafb10b07"), "address" : { "building" : "108", "coord" : [ -73.9293711, 40.7002709 ], "street" : "Central Avenue", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Café/Coffee/Tea", "grades" : [ { "date" : ISODate("2014-03-27T00:00:00Z"), "grade" : "A", "score" : 2 }, { "date" : ISODate("2013-10-15T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2012-10-10T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2011-10-28T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2011-06-22T00:00:00Z"), "grade" : "B", "score" : 14 } ], "name" : "Central Cafe Brooklyn", "restaurant_id" : "41543901" }
{ "_id" : ObjectId("59074c7c057aaffaafb11244"), "address" : { "building" : "824", "coord" : [ -73.9395991, 40.6991473 ], "street" : "Broadway", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Chinese", "grades" : [ { "date" : ISODate("2014-09-16T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-07-06T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2012-07-10T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2011-12-24T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Asian Yummy House", "restaurant_id" : "41616384" }
{ "_id" : ObjectId("59074c7c057aaffaafb112b0"), "address" : { "building" : "141", "coord" : [ -73.94698260000001, 40.7083283 ], "street" : "Leonard Street", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Italian", "grades" : [ { "date" : ISODate("2014-10-01T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2014-03-11T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-12-12T00:00:00Z"), "grade" : "A", "score" : 13 } ], "name" : "Testo", "restaurant_id" : "41618871" }
{ "_id" : ObjectId("59074c7c057aaffaafb114b9"), "address" : { "building" : "442", "coord" : [ -73.9485887, 40.7102648 ], "street" : "Lorimer Street", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Spanish", "grades" : [ { "date" : ISODate("2014-04-02T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-03-27T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2012-10-17T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-03-12T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Warma Cafe", "restaurant_id" : "41632768" }
{ "_id" : ObjectId("59074c7c057aaffaafb11c28"), "address" : { "building" : "25", "coord" : [ -73.93320779999999, 40.7041154 ], "street" : "Bogart Street", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-10-25T00:00:00Z"), "grade" : "A", "score" : 6 }, { "date" : ISODate("2014-05-03T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-02-13T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Tutu's", "restaurant_id" : "41690235" }
{ "_id" : ObjectId("59074c7c057aaffaafb11cb2"), "address" : { "building" : "272", "coord" : [ -73.9378744, 40.7084722 ], "street" : "Meserole Street", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-06-06T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-06-09T00:00:00Z"), "grade" : "A", "score" : 0 } ], "name" : "The Well", "restaurant_id" : "41693931" }
{ "_id" : ObjectId("59074c7c057aaffaafb11fbf"), "address" : { "building" : "785", "coord" : [ -73.9414388, 40.7009835 ], "street" : "Flushing Avenue", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-04-04T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-04-09T00:00:00Z"), "grade" : "A", "score" : 4 } ], "name" : "Taco Bell And Pizza Hut", "restaurant_id" : "41708028" }
> db.restaurants.find( { "grades.grade": {$lt:"B" } } )
{ "_id" : ObjectId("59074c7c057aaffaafb0da64"), "address" : { "building" : "2911", "coord" : [ -73.982241, 40.576366 ], "street" : "West 15 Street", "zipcode" : "11224" }, "borough" : "Brooklyn", "cuisine" : "Italian", "grades" : [ { "date" : ISODate("2014-12-18T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2014-05-15T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-06-12T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-02-06T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Gargiulo's Restaurant", "restaurant_id" : "40365784" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da57"), "address" : { "building" : "72", "coord" : [ -73.92506, 40.8275556 ], "street" : "East 161 Street", "zipcode" : "10451" }, "borough" : "Bronx", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-04-15T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-11-14T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2013-07-29T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2012-12-31T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2012-05-30T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-09T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2011-08-15T00:00:00Z"), "grade" : "C", "score" : 37 } ], "name" : "Yankee Tavern", "restaurant_id" : "40365499" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da6d"), "address" : { "building" : "21", "coord" : [ -73.9990337, 40.7143954 ], "street" : "Mott Street", "zipcode" : "10013" }, "borough" : "Manhattan", "cuisine" : "Chinese", "grades" : [ { "date" : ISODate("2014-07-28T00:00:00Z"), "grade" : "B", "score" : 27 }, { "date" : ISODate("2013-11-19T00:00:00Z"), "grade" : "B", "score" : 20 }, { "date" : ISODate("2013-04-30T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-10-16T00:00:00Z"), "grade" : "B", "score" : 24 }, { "date" : ISODate("2012-05-07T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Hop Kee Restaurant", "restaurant_id" : "40365942" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da6c"), "address" : { "building" : "25541", "coord" : [ -73.70902579999999, 40.7276012 ], "street" : "Jamaica Avenue", "zipcode" : "11001" }, "borough" : "Queens", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-01-16T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2013-06-20T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-10-04T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-10T00:00:00Z"), "grade" : "B", "score" : 20 }, { "date" : ISODate("2011-06-23T00:00:00Z"), "grade" : "B", "score" : 21 } ], "name" : "Nancy's Fire Side", "restaurant_id" : "40365938" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da5e"), "address" : { "building" : "6322", "coord" : [ -73.9896898, 40.6199526 ], "street" : "18 Avenue", "zipcode" : "11204" }, "borough" : "Brooklyn", "cuisine" : "Pizza", "grades" : [ { "date" : ISODate("2014-12-30T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2014-05-15T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-10-29T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-10-06T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-03-29T00:00:00Z"), "grade" : "A", "score" : 13 } ], "name" : "J&V Famous Pizza", "restaurant_id" : "40365632" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da5a"), "address" : { "building" : "229", "coord" : [ -73.9590059, 40.7090147 ], "street" : "Havemeyer Street", "zipcode" : "11211" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-08-18T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2014-01-08T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-05-20T00:00:00Z"), "grade" : "B", "score" : 21 }, { "date" : ISODate("2012-09-20T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2011-09-22T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Reben Luncheonette", "restaurant_id" : "40365546" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da60"), "address" : { "building" : "326", "coord" : [ -73.989131, 40.760039 ], "street" : "West 46 Street", "zipcode" : "10036" }, "borough" : "Manhattan", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-09-10T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-09-25T00:00:00Z"), "grade" : "A", "score" : 6 }, { "date" : ISODate("2012-09-11T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2012-04-19T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2011-10-26T00:00:00Z"), "grade" : "A", "score" : 13 } ], "name" : "Joe Allen Restaurant", "restaurant_id" : "40365644" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da79"), "address" : { "building" : "13558", "coord" : [ -73.8216767, 40.6689548 ], "street" : "Lefferts Boulevard", "zipcode" : "11420" }, "borough" : "Queens", "cuisine" : "Italian", "grades" : [ { "date" : ISODate("2014-06-20T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-06-07T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-06-28T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-13T00:00:00Z"), "grade" : "C", "score" : 28 } ], "name" : "Don Peppe", "restaurant_id" : "40366230" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da72"), "address" : { "building" : "416", "coord" : [ -73.98586209999999, 40.67017250000001 ], "street" : "5 Avenue", "zipcode" : "11215" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-12-04T00:00:00Z"), "grade" : "B", "score" : 22 }, { "date" : ISODate("2014-04-19T00:00:00Z"), "grade" : "A", "score" : 3 }, { "date" : ISODate("2013-02-14T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-12T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Fifth Avenue Bingo", "restaurant_id" : "40366109" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da7b"), "address" : { "building" : "1611", "coord" : [ -73.955074, 40.599217 ], "street" : "Avenue U", "zipcode" : "11229" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-07-02T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-07-10T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-02-13T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2012-08-16T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-03-29T00:00:00Z"), "grade" : "B", "score" : 24 } ], "name" : "Three Star Restaurant", "restaurant_id" : "40366361" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da75"), "address" : { "building" : "146", "coord" : [ -73.9736776, 40.7535755 ], "street" : "East 46 Street", "zipcode" : "10017" }, "borough" : "Manhattan", "cuisine" : "Italian", "grades" : [ { "date" : ISODate("2014-03-11T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-07-31T00:00:00Z"), "grade" : "C", "score" : 53 }, { "date" : ISODate("2012-12-19T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-06-04T00:00:00Z"), "grade" : "C", "score" : 45 }, { "date" : ISODate("2012-01-18T00:00:00Z"), "grade" : "C", "score" : 34 }, { "date" : ISODate("2011-09-28T00:00:00Z"), "grade" : "B", "score" : 18 }, { "date" : ISODate("2011-05-24T00:00:00Z"), "grade" : "C", "score" : 52 } ], "name" : "Nanni Restaurant", "restaurant_id" : "40366157" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da7f"), "address" : { "building" : "6828", "coord" : [ -73.8204154, 40.7242443 ], "street" : "Main Street", "zipcode" : "11367" }, "borough" : "Queens", "cuisine" : "Jewish/Kosher", "grades" : [ { "date" : ISODate("2014-09-24T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2014-03-10T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-05-31T00:00:00Z"), "grade" : "B", "score" : 26 }, { "date" : ISODate("2012-05-10T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2011-11-03T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Naomi Kosher Pizza", "restaurant_id" : "40366425" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da82"), "address" : { "building" : "3432", "coord" : [ -73.9420751, 40.6002442 ], "street" : "Nostrand Avenue", "zipcode" : "11229" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-10-30T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-10-16T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-06-04T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-06-04T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-12-22T00:00:00Z"), "grade" : "A", "score" : 5 } ], "name" : "Brennan & Carr", "restaurant_id" : "40366487" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da8d"), "address" : { "building" : "84", "coord" : [ -73.9300062, 40.5943553 ], "street" : "Ebony Court", "zipcode" : "11229" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-05-21T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-05-21T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-06-06T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-02-01T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Tamaqua", "restaurant_id" : "40366742" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da87"), "address" : { "building" : "71-24", "coord" : [ -73.8221418, 40.7272376 ], "street" : "Main Street", "zipcode" : "11367" }, "borough" : "Queens", "cuisine" : "Jewish/Kosher", "grades" : [ { "date" : ISODate("2014-05-07T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-09-04T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2013-03-21T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-05-23T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-11-01T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Shimons Kosher Pizza", "restaurant_id" : "40366586" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da88"), "address" : { "building" : "225", "coord" : [ -74.0027865, 40.7340505 ], "street" : "West 4 Street", "zipcode" : "10014" }, "borough" : "Manhattan", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-12-16T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-12-09T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-06-19T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2012-06-29T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "The Riviera Cafe", "restaurant_id" : "40366643" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da9a"), "address" : { "building" : "459", "coord" : [ -73.979839, 40.739796 ], "street" : "2 Avenue", "zipcode" : "10010" }, "borough" : "Manhattan", "cuisine" : "Mexican", "grades" : [ { "date" : ISODate("2014-10-30T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2013-11-07T00:00:00Z"), "grade" : "A", "score" : 2 }, { "date" : ISODate("2012-10-23T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2012-05-07T00:00:00Z"), "grade" : "A", "score" : 10 } ], "name" : "Mexico Lindo Restaurant", "restaurant_id" : "40367038" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da96"), "address" : { "building" : "617", "coord" : [ -73.9681178, 40.678776 ], "street" : "Vanderbilt Avenue", "zipcode" : "11238" }, "borough" : "Brooklyn", "cuisine" : "Soul Food", "grades" : [ { "date" : ISODate("2014-08-28T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2014-03-27T00:00:00Z"), "grade" : "C", "score" : 2 }, { "date" : ISODate("2013-07-17T00:00:00Z"), "grade" : "B", "score" : 25 }, { "date" : ISODate("2012-05-17T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2011-12-21T00:00:00Z"), "grade" : "A", "score" : 8 } ], "name" : "Mitchell's Restaurant", "restaurant_id" : "40366961" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da67"), "address" : { "building" : "45-15", "coord" : [ -73.91427200000001, 40.7569379 ], "street" : "Broadway", "zipcode" : "11103" }, "borough" : "Queens", "cuisine" : "American", "grades" : [ { "date" : ISODate("2013-12-04T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-05-02T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2012-03-15T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2011-07-12T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2011-02-16T00:00:00Z"), "grade" : "A", "score" : 7 } ], "name" : "Lavelle's Admiral's Club", "restaurant_id" : "40365844" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da9d"), "address" : { "building" : "421", "coord" : [ -73.99682299999999, 40.753182 ], "street" : "9 Avenue", "zipcode" : "10001" }, "borough" : "Manhattan", "cuisine" : "Irish", "grades" : [ { "date" : ISODate("2014-07-01T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2014-01-28T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2012-12-12T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-12-28T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-09-02T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Twins Pub", "restaurant_id" : "40367179" }
Type "it" for more
> db.restaurants.find({}, {name: 1, "grades.grade": {$lt:"B" } } )
Error: error: {
"ok" : 0,
"errmsg" : "Unsupported projection option: grades.grade: { $lt: \"B\" }",
"code" : 2,
"codeName" : "BadValue"
}
> db.restaurants.find({}, {name: 1, "grades.grade": {$gt:"C" } } )
Error: error: {
"ok" : 0,
"errmsg" : "Unsupported projection option: grades.grade: { $gt: \"C\" }",
"code" : 2,
"codeName" : "BadValue"
}
> db.restaurants.find( { name: 1, "grades.grade":"C" } } )
2018-08-31T09:41:02.145-0700 E QUERY [js] SyntaxError: missing ) after argument list @(shell):1:53
> db.restaurants.find( { name: 1, "grades.grade":"C" } )
> db.restaurants.find( { "address.zipcode": "11206" } )
{ "_id" : ObjectId("59074c7c057aaffaafb0e874"), "address" : { "building" : "241", "coord" : [ -73.9398247, 40.7076864 ], "street" : "Bushwick Avenue", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Pizza/Italian", "grades" : [ { "date" : ISODate("2014-11-06T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2013-11-18T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-06-26T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-12-17T00:00:00Z"), "grade" : "C", "score" : 40 } ], "name" : "Danny's Pizzeria & Cafe", "restaurant_id" : "40887949" }
{ "_id" : ObjectId("59074c7c057aaffaafb0ee95"), "address" : { "building" : "712", "coord" : [ -73.943236, 40.701137 ], "street" : "Broadway", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-10-20T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2014-05-06T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-11-20T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-06-18T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-01-29T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-07-25T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-03-01T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Bed Stuy Diner", "restaurant_id" : "41081103" }
{ "_id" : ObjectId("59074c7c057aaffaafb0eef4"), "address" : { "building" : "223", "coord" : [ -73.939621, 40.708255 ], "street" : "Bushwick Avenue", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Mexican", "grades" : [ { "date" : ISODate("2014-04-04T00:00:00Z"), "grade" : "A", "score" : 2 }, { "date" : ISODate("2013-10-21T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-10-17T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-10-13T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Jessi Bakery", "restaurant_id" : "41090020" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f0b3"), "address" : { "building" : "801", "coord" : [ -73.9400543, 40.6998615 ], "street" : "Broadway", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Café/Coffee/Tea", "grades" : [ { "date" : ISODate("2014-09-30T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2014-05-06T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-04-18T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-04-30T00:00:00Z"), "grade" : "A", "score" : 6 }, { "date" : ISODate("2011-12-28T00:00:00Z"), "grade" : "A", "score" : 5 } ], "name" : "Jk & Sons Coffee Shop", "restaurant_id" : "41139783" }
{ "_id" : ObjectId("59074c7c057aaffaafb0fd79"), "address" : { "building" : "279", "coord" : [ -73.9394658, 40.7065248 ], "street" : "Bushwick Avenue", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Thai", "grades" : [ { "date" : ISODate("2014-06-28T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2013-06-27T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-12-18T00:00:00Z"), "grade" : "B", "score" : 21 } ], "name" : "Note Thai", "restaurant_id" : "41373868" }
{ "_id" : ObjectId("59074c7c057aaffaafb105d5"), "address" : { "building" : "830", "coord" : [ -73.939466, 40.6990399 ], "street" : "Broadway", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Mexican", "grades" : [ { "date" : ISODate("2014-09-11T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2014-04-24T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-10-21T00:00:00Z"), "grade" : "C", "score" : 41 }, { "date" : ISODate("2012-08-30T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2011-09-20T00:00:00Z"), "grade" : "A", "score" : 13 } ], "name" : "Taqueria La Placita Puebla", "restaurant_id" : "41474967" }
{ "_id" : ObjectId("59074c7c057aaffaafb10887"), "address" : { "building" : "202", "coord" : [ -73.947064, 40.7109698 ], "street" : "Leonard Street", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Mexican", "grades" : [ { "date" : ISODate("2014-04-04T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-10-21T00:00:00Z"), "grade" : "B", "score" : 27 }, { "date" : ISODate("2013-05-14T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2012-09-24T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-09-15T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-05-06T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Haab", "restaurant_id" : "41508916" }
{ "_id" : ObjectId("59074c7c057aaffaafb109f6"), "address" : { "building" : "941", "coord" : [ -73.9353977, 40.6972074 ], "street" : "Broadway", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Spanish", "grades" : [ { "date" : ISODate("2015-01-16T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2014-01-09T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-07-31T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-02-28T00:00:00Z"), "grade" : "B", "score" : 19 }, { "date" : ISODate("2012-08-20T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2012-03-23T00:00:00Z"), "grade" : "B", "score" : 19 } ], "name" : "Loma Restaurant Coffee Shop", "restaurant_id" : "41531073" }
{ "_id" : ObjectId("59074c7c057aaffaafb10b07"), "address" : { "building" : "108", "coord" : [ -73.9293711, 40.7002709 ], "street" : "Central Avenue", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Café/Coffee/Tea", "grades" : [ { "date" : ISODate("2014-03-27T00:00:00Z"), "grade" : "A", "score" : 2 }, { "date" : ISODate("2013-10-15T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2012-10-10T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2011-10-28T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2011-06-22T00:00:00Z"), "grade" : "B", "score" : 14 } ], "name" : "Central Cafe Brooklyn", "restaurant_id" : "41543901" }
{ "_id" : ObjectId("59074c7c057aaffaafb11244"), "address" : { "building" : "824", "coord" : [ -73.9395991, 40.6991473 ], "street" : "Broadway", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Chinese", "grades" : [ { "date" : ISODate("2014-09-16T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-07-06T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2012-07-10T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2011-12-24T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Asian Yummy House", "restaurant_id" : "41616384" }
{ "_id" : ObjectId("59074c7c057aaffaafb112b0"), "address" : { "building" : "141", "coord" : [ -73.94698260000001, 40.7083283 ], "street" : "Leonard Street", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Italian", "grades" : [ { "date" : ISODate("2014-10-01T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2014-03-11T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-12-12T00:00:00Z"), "grade" : "A", "score" : 13 } ], "name" : "Testo", "restaurant_id" : "41618871" }
{ "_id" : ObjectId("59074c7c057aaffaafb114b9"), "address" : { "building" : "442", "coord" : [ -73.9485887, 40.7102648 ], "street" : "Lorimer Street", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "Spanish", "grades" : [ { "date" : ISODate("2014-04-02T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-03-27T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2012-10-17T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-03-12T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Warma Cafe", "restaurant_id" : "41632768" }
{ "_id" : ObjectId("59074c7c057aaffaafb11c28"), "address" : { "building" : "25", "coord" : [ -73.93320779999999, 40.7041154 ], "street" : "Bogart Street", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-10-25T00:00:00Z"), "grade" : "A", "score" : 6 }, { "date" : ISODate("2014-05-03T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-02-13T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Tutu's", "restaurant_id" : "41690235" }
{ "_id" : ObjectId("59074c7c057aaffaafb11cb2"), "address" : { "building" : "272", "coord" : [ -73.9378744, 40.7084722 ], "street" : "Meserole Street", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-06-06T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-06-09T00:00:00Z"), "grade" : "A", "score" : 0 } ], "name" : "The Well", "restaurant_id" : "41693931" }
{ "_id" : ObjectId("59074c7c057aaffaafb11fbf"), "address" : { "building" : "785", "coord" : [ -73.9414388, 40.7009835 ], "street" : "Flushing Avenue", "zipcode" : "11206" }, "borough" : "Brooklyn", "cuisine" : "American", "grades" : [ { "date" : ISODate("2014-04-04T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-04-09T00:00:00Z"), "grade" : "A", "score" : 4 } ], "name" : "Taco Bell And Pizza Hut", "restaurant_id" : "41708028" }
> db.restaurants.find( { "address.zipcode": "11206" }, {name: 1} )
{ "_id" : ObjectId("59074c7c057aaffaafb0e874"), "name" : "Danny's Pizzeria & Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0ee95"), "name" : "Bed Stuy Diner" }
{ "_id" : ObjectId("59074c7c057aaffaafb0eef4"), "name" : "Jessi Bakery" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f0b3"), "name" : "Jk & Sons Coffee Shop" }
{ "_id" : ObjectId("59074c7c057aaffaafb0fd79"), "name" : "Note Thai" }
{ "_id" : ObjectId("59074c7c057aaffaafb105d5"), "name" : "Taqueria La Placita Puebla" }
{ "_id" : ObjectId("59074c7c057aaffaafb10887"), "name" : "Haab" }
{ "_id" : ObjectId("59074c7c057aaffaafb109f6"), "name" : "Loma Restaurant Coffee Shop" }
{ "_id" : ObjectId("59074c7c057aaffaafb10b07"), "name" : "Central Cafe Brooklyn" }
{ "_id" : ObjectId("59074c7c057aaffaafb11244"), "name" : "Asian Yummy House" }
{ "_id" : ObjectId("59074c7c057aaffaafb112b0"), "name" : "Testo" }
{ "_id" : ObjectId("59074c7c057aaffaafb114b9"), "name" : "Warma Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb11c28"), "name" : "Tutu's" }
{ "_id" : ObjectId("59074c7c057aaffaafb11cb2"), "name" : "The Well" }
{ "_id" : ObjectId("59074c7c057aaffaafb11fbf"), "name" : "Taco Bell And Pizza Hut" }
> db.restaurants.find( { "address.zipcode": "11206" }, {name: 1, address: 1} )
{ "_id" : ObjectId("59074c7c057aaffaafb0e874"), "address" : { "building" : "241", "coord" : [ -73.9398247, 40.7076864 ], "street" : "Bushwick Avenue", "zipcode" : "11206" }, "name" : "Danny's Pizzeria & Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0ee95"), "address" : { "building" : "712", "coord" : [ -73.943236, 40.701137 ], "street" : "Broadway", "zipcode" : "11206" }, "name" : "Bed Stuy Diner" }
{ "_id" : ObjectId("59074c7c057aaffaafb0eef4"), "address" : { "building" : "223", "coord" : [ -73.939621, 40.708255 ], "street" : "Bushwick Avenue", "zipcode" : "11206" }, "name" : "Jessi Bakery" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f0b3"), "address" : { "building" : "801", "coord" : [ -73.9400543, 40.6998615 ], "street" : "Broadway", "zipcode" : "11206" }, "name" : "Jk & Sons Coffee Shop" }
{ "_id" : ObjectId("59074c7c057aaffaafb0fd79"), "address" : { "building" : "279", "coord" : [ -73.9394658, 40.7065248 ], "street" : "Bushwick Avenue", "zipcode" : "11206" }, "name" : "Note Thai" }
{ "_id" : ObjectId("59074c7c057aaffaafb105d5"), "address" : { "building" : "830", "coord" : [ -73.939466, 40.6990399 ], "street" : "Broadway", "zipcode" : "11206" }, "name" : "Taqueria La Placita Puebla" }
{ "_id" : ObjectId("59074c7c057aaffaafb10887"), "address" : { "building" : "202", "coord" : [ -73.947064, 40.7109698 ], "street" : "Leonard Street", "zipcode" : "11206" }, "name" : "Haab" }
{ "_id" : ObjectId("59074c7c057aaffaafb109f6"), "address" : { "building" : "941", "coord" : [ -73.9353977, 40.6972074 ], "street" : "Broadway", "zipcode" : "11206" }, "name" : "Loma Restaurant Coffee Shop" }
{ "_id" : ObjectId("59074c7c057aaffaafb10b07"), "address" : { "building" : "108", "coord" : [ -73.9293711, 40.7002709 ], "street" : "Central Avenue", "zipcode" : "11206" }, "name" : "Central Cafe Brooklyn" }
{ "_id" : ObjectId("59074c7c057aaffaafb11244"), "address" : { "building" : "824", "coord" : [ -73.9395991, 40.6991473 ], "street" : "Broadway", "zipcode" : "11206" }, "name" : "Asian Yummy House" }
{ "_id" : ObjectId("59074c7c057aaffaafb112b0"), "address" : { "building" : "141", "coord" : [ -73.94698260000001, 40.7083283 ], "street" : "Leonard Street", "zipcode" : "11206" }, "name" : "Testo" }
{ "_id" : ObjectId("59074c7c057aaffaafb114b9"), "address" : { "building" : "442", "coord" : [ -73.9485887, 40.7102648 ], "street" : "Lorimer Street", "zipcode" : "11206" }, "name" : "Warma Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb11c28"), "address" : { "building" : "25", "coord" : [ -73.93320779999999, 40.7041154 ], "street" : "Bogart Street", "zipcode" : "11206" }, "name" : "Tutu's" }
{ "_id" : ObjectId("59074c7c057aaffaafb11cb2"), "address" : { "building" : "272", "coord" : [ -73.9378744, 40.7084722 ], "street" : "Meserole Street", "zipcode" : "11206" }, "name" : "The Well" }
{ "_id" : ObjectId("59074c7c057aaffaafb11fbf"), "address" : { "building" : "785", "coord" : [ -73.9414388, 40.7009835 ], "street" : "Flushing Avenue", "zipcode" : "11206" }, "name" : "Taco Bell And Pizza Hut" }
> db.restaurants.find( { "address.zipcode": "11206" }, {name: 1, "address.zipcode": 1} )
{ "_id" : ObjectId("59074c7c057aaffaafb0e874"), "address" : { "zipcode" : "11206" }, "name" : "Danny's Pizzeria & Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0ee95"), "address" : { "zipcode" : "11206" }, "name" : "Bed Stuy Diner" }
{ "_id" : ObjectId("59074c7c057aaffaafb0eef4"), "address" : { "zipcode" : "11206" }, "name" : "Jessi Bakery" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f0b3"), "address" : { "zipcode" : "11206" }, "name" : "Jk & Sons Coffee Shop" }
{ "_id" : ObjectId("59074c7c057aaffaafb0fd79"), "address" : { "zipcode" : "11206" }, "name" : "Note Thai" }
{ "_id" : ObjectId("59074c7c057aaffaafb105d5"), "address" : { "zipcode" : "11206" }, "name" : "Taqueria La Placita Puebla" }
{ "_id" : ObjectId("59074c7c057aaffaafb10887"), "address" : { "zipcode" : "11206" }, "name" : "Haab" }
{ "_id" : ObjectId("59074c7c057aaffaafb109f6"), "address" : { "zipcode" : "11206" }, "name" : "Loma Restaurant Coffee Shop" }
{ "_id" : ObjectId("59074c7c057aaffaafb10b07"), "address" : { "zipcode" : "11206" }, "name" : "Central Cafe Brooklyn" }
{ "_id" : ObjectId("59074c7c057aaffaafb11244"), "address" : { "zipcode" : "11206" }, "name" : "Asian Yummy House" }
{ "_id" : ObjectId("59074c7c057aaffaafb112b0"), "address" : { "zipcode" : "11206" }, "name" : "Testo" }
{ "_id" : ObjectId("59074c7c057aaffaafb114b9"), "address" : { "zipcode" : "11206" }, "name" : "Warma Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb11c28"), "address" : { "zipcode" : "11206" }, "name" : "Tutu's" }
{ "_id" : ObjectId("59074c7c057aaffaafb11cb2"), "address" : { "zipcode" : "11206" }, "name" : "The Well" }
{ "_id" : ObjectId("59074c7c057aaffaafb11fbf"), "address" : { "zipcode" : "11206" }, "name" : "Taco Bell And Pizza Hut" }
> db.restaurants.find( { "address.zipcode": "11206" }, {name: 1, address.zipcode: 1} )
2018-08-31T09:42:42.392-0700 E QUERY [js] SyntaxError: missing : after property id @(shell):1:70
> db.restaurants.find( { "address.zipcode": "11206" }, {name: 1, "address.zipcode": 1} )
{ "_id" : ObjectId("59074c7c057aaffaafb0e874"), "address" : { "zipcode" : "11206" }, "name" : "Danny's Pizzeria & Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0ee95"), "address" : { "zipcode" : "11206" }, "name" : "Bed Stuy Diner" }
{ "_id" : ObjectId("59074c7c057aaffaafb0eef4"), "address" : { "zipcode" : "11206" }, "name" : "Jessi Bakery" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f0b3"), "address" : { "zipcode" : "11206" }, "name" : "Jk & Sons Coffee Shop" }
{ "_id" : ObjectId("59074c7c057aaffaafb0fd79"), "address" : { "zipcode" : "11206" }, "name" : "Note Thai" }
{ "_id" : ObjectId("59074c7c057aaffaafb105d5"), "address" : { "zipcode" : "11206" }, "name" : "Taqueria La Placita Puebla" }
{ "_id" : ObjectId("59074c7c057aaffaafb10887"), "address" : { "zipcode" : "11206" }, "name" : "Haab" }
{ "_id" : ObjectId("59074c7c057aaffaafb109f6"), "address" : { "zipcode" : "11206" }, "name" : "Loma Restaurant Coffee Shop" }
{ "_id" : ObjectId("59074c7c057aaffaafb10b07"), "address" : { "zipcode" : "11206" }, "name" : "Central Cafe Brooklyn" }
{ "_id" : ObjectId("59074c7c057aaffaafb11244"), "address" : { "zipcode" : "11206" }, "name" : "Asian Yummy House" }
{ "_id" : ObjectId("59074c7c057aaffaafb112b0"), "address" : { "zipcode" : "11206" }, "name" : "Testo" }
{ "_id" : ObjectId("59074c7c057aaffaafb114b9"), "address" : { "zipcode" : "11206" }, "name" : "Warma Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb11c28"), "address" : { "zipcode" : "11206" }, "name" : "Tutu's" }
{ "_id" : ObjectId("59074c7c057aaffaafb11cb2"), "address" : { "zipcode" : "11206" }, "name" : "The Well" }
{ "_id" : ObjectId("59074c7c057aaffaafb11fbf"), "address" : { "zipcode" : "11206" }, "name" : "Taco Bell And Pizza Hut" }
> db.restaurants.find( { "grades.grade": "B" }, {name: 1, "address.zipcode": 1, grades: 1 } )
{ "_id" : ObjectId("59074c7c057aaffaafb0da57"), "address" : { "zipcode" : "10451" }, "grades" : [ { "date" : ISODate("2014-04-15T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-11-14T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2013-07-29T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2012-12-31T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2012-05-30T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-09T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2011-08-15T00:00:00Z"), "grade" : "C", "score" : 37 } ], "name" : "Yankee Tavern" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da6d"), "address" : { "zipcode" : "10013" }, "grades" : [ { "date" : ISODate("2014-07-28T00:00:00Z"), "grade" : "B", "score" : 27 }, { "date" : ISODate("2013-11-19T00:00:00Z"), "grade" : "B", "score" : 20 }, { "date" : ISODate("2013-04-30T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-10-16T00:00:00Z"), "grade" : "B", "score" : 24 }, { "date" : ISODate("2012-05-07T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Hop Kee Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da6c"), "address" : { "zipcode" : "11001" }, "grades" : [ { "date" : ISODate("2014-01-16T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2013-06-20T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-10-04T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-10T00:00:00Z"), "grade" : "B", "score" : 20 }, { "date" : ISODate("2011-06-23T00:00:00Z"), "grade" : "B", "score" : 21 } ], "name" : "Nancy's Fire Side" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da5a"), "address" : { "zipcode" : "11211" }, "grades" : [ { "date" : ISODate("2014-08-18T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2014-01-08T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-05-20T00:00:00Z"), "grade" : "B", "score" : 21 }, { "date" : ISODate("2012-09-20T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2011-09-22T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Reben Luncheonette" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da72"), "address" : { "zipcode" : "11215" }, "grades" : [ { "date" : ISODate("2014-12-04T00:00:00Z"), "grade" : "B", "score" : 22 }, { "date" : ISODate("2014-04-19T00:00:00Z"), "grade" : "A", "score" : 3 }, { "date" : ISODate("2013-02-14T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-12T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Fifth Avenue Bingo" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da7b"), "address" : { "zipcode" : "11229" }, "grades" : [ { "date" : ISODate("2014-07-02T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-07-10T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-02-13T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2012-08-16T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-03-29T00:00:00Z"), "grade" : "B", "score" : 24 } ], "name" : "Three Star Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da75"), "address" : { "zipcode" : "10017" }, "grades" : [ { "date" : ISODate("2014-03-11T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-07-31T00:00:00Z"), "grade" : "C", "score" : 53 }, { "date" : ISODate("2012-12-19T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-06-04T00:00:00Z"), "grade" : "C", "score" : 45 }, { "date" : ISODate("2012-01-18T00:00:00Z"), "grade" : "C", "score" : 34 }, { "date" : ISODate("2011-09-28T00:00:00Z"), "grade" : "B", "score" : 18 }, { "date" : ISODate("2011-05-24T00:00:00Z"), "grade" : "C", "score" : 52 } ], "name" : "Nanni Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da7f"), "address" : { "zipcode" : "11367" }, "grades" : [ { "date" : ISODate("2014-09-24T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2014-03-10T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-05-31T00:00:00Z"), "grade" : "B", "score" : 26 }, { "date" : ISODate("2012-05-10T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2011-11-03T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Naomi Kosher Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da87"), "address" : { "zipcode" : "11367" }, "grades" : [ { "date" : ISODate("2014-05-07T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-09-04T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2013-03-21T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-05-23T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-11-01T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Shimons Kosher Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da96"), "address" : { "zipcode" : "11238" }, "grades" : [ { "date" : ISODate("2014-08-28T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2014-03-27T00:00:00Z"), "grade" : "C", "score" : 2 }, { "date" : ISODate("2013-07-17T00:00:00Z"), "grade" : "B", "score" : 25 }, { "date" : ISODate("2012-05-17T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2011-12-21T00:00:00Z"), "grade" : "A", "score" : 8 } ], "name" : "Mitchell's Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0daa3"), "address" : { "zipcode" : "11360" }, "grades" : [ { "date" : ISODate("2015-01-06T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2014-01-21T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-01-29T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-05-16T00:00:00Z"), "grade" : "B", "score" : 25 } ], "name" : "Jack's Pizza & Pasta" }
{ "_id" : ObjectId("59074c7c057aaffaafb0daa2"), "address" : { "zipcode" : "10021" }, "grades" : [ { "date" : ISODate("2014-10-31T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2014-02-18T00:00:00Z"), "grade" : "B", "score" : 24 }, { "date" : ISODate("2012-11-21T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-06-25T00:00:00Z"), "grade" : "A", "score" : 10 } ], "name" : "Jg Melon Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dabe"), "address" : { "zipcode" : "11223" }, "grades" : [ { "date" : ISODate("2014-07-16T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2013-11-21T00:00:00Z"), "grade" : "B", "score" : 17 }, { "date" : ISODate("2013-05-09T00:00:00Z"), "grade" : "B", "score" : 27 }, { "date" : ISODate("2012-10-25T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-04-17T00:00:00Z"), "grade" : "A", "score" : 11 } ], "name" : "Lb Spumoni Gardens" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dad0"), "address" : { "zipcode" : "10014" }, "grades" : [ { "date" : ISODate("2014-08-21T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2014-03-24T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-01-24T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2012-06-14T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2011-11-03T00:00:00Z"), "grade" : "B", "score" : 15 } ], "name" : "Da Silvano Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dad3"), "address" : { "zipcode" : "11211" }, "grades" : [ { "date" : ISODate("2014-03-13T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-07-31T00:00:00Z"), "grade" : "A", "score" : 6 }, { "date" : ISODate("2013-02-13T00:00:00Z"), "grade" : "B", "score" : 18 }, { "date" : ISODate("2012-07-25T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-02-07T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Frost Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0daab"), "address" : { "zipcode" : "10003" }, "grades" : [ { "date" : ISODate("2014-06-19T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-09-16T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-03-11T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-06-12T00:00:00Z"), "grade" : "B", "score" : 17 }, { "date" : ISODate("2011-10-27T00:00:00Z"), "grade" : "A", "score" : 13 } ], "name" : "Grassroot Tavern" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dae1"), "address" : { "zipcode" : "11367" }, "grades" : [ { "date" : ISODate("2014-09-24T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2014-05-13T00:00:00Z"), "grade" : "B", "score" : 19 }, { "date" : ISODate("2013-04-16T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2012-10-18T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2012-05-23T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2011-11-03T00:00:00Z"), "grade" : "A", "score" : 6 } ], "name" : "Valentino's Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0daeb"), "address" : { "zipcode" : "11354" }, "grades" : [ { "date" : ISODate("2014-09-18T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2014-02-18T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-06-08T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-09-15T00:00:00Z"), "grade" : "B", "score" : 26 }, { "date" : ISODate("2011-12-07T00:00:00Z"), "grade" : "B", "score" : 16 } ], "name" : "Whitestone Lanes" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dab5"), "address" : { "zipcode" : "11414" }, "grades" : [ { "date" : ISODate("2014-10-29T00:00:00Z"), "grade" : "B", "score" : 16 }, { "date" : ISODate("2014-03-26T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-08-22T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-04-25T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2011-11-03T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Lenny's Clam Bar" }
{ "_id" : ObjectId("59074c7c057aaffaafb0daf3"), "address" : { "zipcode" : "10003" }, "grades" : [ { "date" : ISODate("2015-01-07T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2014-06-26T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2014-01-09T00:00:00Z"), "grade" : "A", "score" : 6 }, { "date" : ISODate("2013-04-02T00:00:00Z"), "grade" : "B", "score" : 14 }, { "date" : ISODate("2012-05-14T00:00:00Z"), "grade" : "B", "score" : 19 } ], "name" : "Knickerbocker Bar & Grill" }
Type "it" for more
> db.restaurants.find( { "grades.grade": {$gt: "B"} }, {name: 1, grades: 1 } )
{ "_id" : ObjectId("59074c7c057aaffaafb0da57"), "grades" : [ { "date" : ISODate("2014-04-15T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-11-14T00:00:00Z"), "grade" : "A", "score" : 4 }, { "date" : ISODate("2013-07-29T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2012-12-31T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2012-05-30T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-09T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2011-08-15T00:00:00Z"), "grade" : "C", "score" : 37 } ], "name" : "Yankee Tavern" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da79"), "grades" : [ { "date" : ISODate("2014-06-20T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-06-07T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-06-28T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2012-01-13T00:00:00Z"), "grade" : "C", "score" : 28 } ], "name" : "Don Peppe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da75"), "grades" : [ { "date" : ISODate("2014-03-11T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-07-31T00:00:00Z"), "grade" : "C", "score" : 53 }, { "date" : ISODate("2012-12-19T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-06-04T00:00:00Z"), "grade" : "C", "score" : 45 }, { "date" : ISODate("2012-01-18T00:00:00Z"), "grade" : "C", "score" : 34 }, { "date" : ISODate("2011-09-28T00:00:00Z"), "grade" : "B", "score" : 18 }, { "date" : ISODate("2011-05-24T00:00:00Z"), "grade" : "C", "score" : 52 } ], "name" : "Nanni Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da96"), "grades" : [ { "date" : ISODate("2014-08-28T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2014-03-27T00:00:00Z"), "grade" : "C", "score" : 2 }, { "date" : ISODate("2013-07-17T00:00:00Z"), "grade" : "B", "score" : 25 }, { "date" : ISODate("2012-05-17T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2011-12-21T00:00:00Z"), "grade" : "A", "score" : 8 } ], "name" : "Mitchell's Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0daca"), "grades" : [ { "date" : ISODate("2014-03-31T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-07-29T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-02-25T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-06-21T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2011-12-12T00:00:00Z"), "grade" : "C", "score" : 31 }, { "date" : ISODate("2011-06-27T00:00:00Z"), "grade" : "A", "score" : 13 } ], "name" : "Oyster Bar" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db3c"), "grades" : [ { "date" : ISODate("2014-06-24T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-10-17T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-04-24T00:00:00Z"), "grade" : "C", "score" : 42 }, { "date" : ISODate("2012-10-18T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-05-24T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2011-12-30T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "North Shore Diner" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db81"), "grades" : [ { "date" : ISODate("2014-10-28T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2014-07-09T00:00:00Z"), "grade" : "B", "score" : 24 }, { "date" : ISODate("2014-01-17T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-05-28T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-03-27T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2011-11-02T00:00:00Z"), "grade" : "C", "score" : 28 } ], "name" : "Agra Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db6f"), "grades" : [ { "date" : ISODate("2014-11-26T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2014-04-09T00:00:00Z"), "grade" : "B", "score" : 24 }, { "date" : ISODate("2013-09-19T00:00:00Z"), "grade" : "B", "score" : 27 }, { "date" : ISODate("2012-12-27T00:00:00Z"), "grade" : "B", "score" : 23 }, { "date" : ISODate("2012-05-21T00:00:00Z"), "grade" : "C", "score" : 68 } ], "name" : "Victoria Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db9f"), "grades" : [ { "date" : ISODate("2014-10-15T00:00:00Z"), "grade" : "B", "score" : 24 }, { "date" : ISODate("2014-02-25T00:00:00Z"), "grade" : "B", "score" : 27 }, { "date" : ISODate("2013-07-12T00:00:00Z"), "grade" : "C", "score" : 10 }, { "date" : ISODate("2012-10-24T00:00:00Z"), "grade" : "B", "score" : 26 }, { "date" : ISODate("2012-04-04T00:00:00Z"), "grade" : "B", "score" : 23 } ], "name" : "Tomoe Sushi" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dba9"), "grades" : [ { "date" : ISODate("2014-01-07T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-01-19T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-06-05T00:00:00Z"), "grade" : "C", "score" : 30 } ], "name" : "Vesuvio Restaurant & Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dbc0"), "grades" : [ { "date" : ISODate("2014-08-15T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2014-03-17T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2013-01-31T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-08-07T00:00:00Z"), "grade" : "C", "score" : 56 }, { "date" : ISODate("2011-12-28T00:00:00Z"), "grade" : "A", "score" : 10 } ], "name" : "Kosher Hut Of Brooklyn" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dc26"), "grades" : [ { "date" : ISODate("2014-02-27T00:00:00Z"), "grade" : "A", "score" : 2 }, { "date" : ISODate("2013-08-28T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-02-11T00:00:00Z"), "grade" : "A", "score" : 8 }, { "date" : ISODate("2012-08-15T00:00:00Z"), "grade" : "C", "score" : 31 }, { "date" : ISODate("2012-03-08T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2011-10-25T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2011-05-10T00:00:00Z"), "grade" : "A", "score" : 8 } ], "name" : "Dream Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dc2a"), "grades" : [ { "date" : ISODate("2014-05-08T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-04-10T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-09-04T00:00:00Z"), "grade" : "B", "score" : 17 }, { "date" : ISODate("2012-04-10T00:00:00Z"), "grade" : "C", "score" : 38 }, { "date" : ISODate("2011-11-21T00:00:00Z"), "grade" : "B", "score" : 15 }, { "date" : ISODate("2011-07-07T00:00:00Z"), "grade" : "B", "score" : 23 } ], "name" : "Kanes Deli Diner" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dc39"), "grades" : [ { "date" : ISODate("2014-07-31T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2014-02-19T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-01-07T00:00:00Z"), "grade" : "A", "score" : 2 }, { "date" : ISODate("2012-06-14T00:00:00Z"), "grade" : "A", "score" : 2 }, { "date" : ISODate("2012-01-11T00:00:00Z"), "grade" : "C", "score" : 52 } ], "name" : "De Robertis Pastry Shop" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dc38"), "grades" : [ { "date" : ISODate("2014-10-23T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2014-01-14T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-04-03T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2012-09-28T00:00:00Z"), "grade" : "C", "score" : 0 }, { "date" : ISODate("2012-02-15T00:00:00Z"), "grade" : "B", "score" : 14 } ], "name" : "Automatic Slims" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dc42"), "grades" : [ { "date" : ISODate("2014-08-15T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2013-12-19T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2013-06-04T00:00:00Z"), "grade" : "C", "score" : 40 }, { "date" : ISODate("2012-09-11T00:00:00Z"), "grade" : "B", "score" : 27 }, { "date" : ISODate("2012-04-18T00:00:00Z"), "grade" : "B", "score" : 21 }, { "date" : ISODate("2011-10-31T00:00:00Z"), "grade" : "A", "score" : 12 } ], "name" : "Sushiden" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dc46"), "grades" : [ { "date" : ISODate("2014-04-23T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-04-03T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2012-09-04T00:00:00Z"), "grade" : "B", "score" : 16 }, { "date" : ISODate("2012-02-07T00:00:00Z"), "grade" : "B", "score" : 17 }, { "date" : ISODate("2011-10-20T00:00:00Z"), "grade" : "C", "score" : 30 } ], "name" : "Academy Restauraunt" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dc97"), "grades" : [ { "date" : ISODate("2014-12-30T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2014-05-15T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-11-19T00:00:00Z"), "grade" : "A", "score" : 9 }, { "date" : ISODate("2013-05-14T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-11-20T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2012-07-23T00:00:00Z"), "grade" : "A", "score" : 7 }, { "date" : ISODate("2012-01-26T00:00:00Z"), "grade" : "C", "score" : 42 } ], "name" : "Amnon Kosher Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dc9d"), "grades" : [ { "date" : ISODate("2014-10-27T00:00:00Z"), "grade" : "A", "score" : 5 }, { "date" : ISODate("2014-04-22T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2013-08-22T00:00:00Z"), "grade" : "C", "score" : 52 }, { "date" : ISODate("2012-12-27T00:00:00Z"), "grade" : "A", "score" : 12 }, { "date" : ISODate("2011-12-23T00:00:00Z"), "grade" : "A", "score" : 9 } ], "name" : "Lee's Villa Chinese Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dcc9"), "grades" : [ { "date" : ISODate("2014-05-29T00:00:00Z"), "grade" : "A", "score" : 13 }, { "date" : ISODate("2013-11-14T00:00:00Z"), "grade" : "B", "score" : 26 }, { "date" : ISODate("2012-09-12T00:00:00Z"), "grade" : "A", "score" : 10 }, { "date" : ISODate("2011-10-04T00:00:00Z"), "grade" : "A", "score" : 11 }, { "date" : ISODate("2011-06-23T00:00:00Z"), "grade" : "C", "score" : 29 } ], "name" : "Rino's" }
Type "it" for more
> db.restaurants.find( { "grades.grade": {$lt: "B"} }, {name: 1, "grades.grade": 1 } )
{ "_id" : ObjectId("59074c7c057aaffaafb0da64"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "Gargiulo's Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da57"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "B" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "C" } ], "name" : "Yankee Tavern" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da6d"), "grades" : [ { "grade" : "B" }, { "grade" : "B" }, { "grade" : "A" }, { "grade" : "B" }, { "grade" : "A" } ], "name" : "Hop Kee Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da6c"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "B" }, { "grade" : "B" } ], "name" : "Nancy's Fire Side" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da5e"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "J&V Famous Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da5a"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "B" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "Reben Luncheonette" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da60"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "Joe Allen Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da79"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "C" } ], "name" : "Don Peppe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da72"), "grades" : [ { "grade" : "B" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "Fifth Avenue Bingo" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da7b"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "B" } ], "name" : "Three Star Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da75"), "grades" : [ { "grade" : "A" }, { "grade" : "C" }, { "grade" : "A" }, { "grade" : "C" }, { "grade" : "C" }, { "grade" : "B" }, { "grade" : "C" } ], "name" : "Nanni Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da7f"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "B" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "Naomi Kosher Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da82"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "Brennan & Carr" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da8d"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "Tamaqua" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da87"), "grades" : [ { "grade" : "A" }, { "grade" : "B" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "Shimons Kosher Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da88"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "The Riviera Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da9a"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "Mexico Lindo Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da96"), "grades" : [ { "grade" : "A" }, { "grade" : "C" }, { "grade" : "B" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "Mitchell's Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da67"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "Lavelle's Admiral's Club" }
{ "_id" : ObjectId("59074c7c057aaffaafb0da9d"), "grades" : [ { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" }, { "grade" : "A" } ], "name" : "Twins Pub" }
Type "it" for more
> db.restaurants.findOne({})._id
ObjectId("59074c7c057aaffaafb0da64")
> db.restaurant.remove({_id: "59074c7c057aaffaafb0da64"})
WriteResult({ "nRemoved" : 0 })
> db.restaurants.find({_id: "59074c7c057aaffaafb0da64"}).count();
0
> db.restaurants.findOne({})._id
ObjectId("59074c7c057aaffaafb0da64")
> db.restaurants.replaceOne (
... {_id: "59074c7c057aaffaafb0da64"},
... { name: "This restaurant is better than the one that was here"}
... );
{ "acknowledged" : true, "matchedCount" : 0, "modifiedCount" : 0 }
> db.restaurants.find({_id: "59074c7c057aaffaafb0da64"})
> db.restaurants.find({_id: "59074c7c057aaffaafb0da64"});
> db.restaurants.findOne({_id: "59074c7c057aaffaafb0da64"});
null
> db.restaurants.findOne({_id: "59074c7c057aaffaafb0da64"});
null
> db.restaurants.findOne({name: "This restaurant is better than the one that was here"});
null
> db.restaurants.findOne({})._id
ObjectId("59074c7c057aaffaafb0da64")
> db.restaurants.replaceOne (
...
...
> var objectId = db.restaurants.findOne({})._id
> db.restaurants.replaceOne(
... {_id: objectId},
... {name: "This is the best"}
... );
{ "acknowledged" : true, "matchedCount" : 1, "modifiedCount" : 1 }
> db.restaurants.findOne({_id: objectId});
{ "_id" : ObjectId("59074c7c057aaffaafb0da64"), "name" : "This is the best" }
> var objectId = db.restaurants.findOne({})._id
> db.restaurants.findOne({_id: objectId});
{ "_id" : ObjectId("59074c7c057aaffaafb0da64"), "name" : "This is the best" }
> var objectId = db.restaurants.findOne({})._id
> db.restaurants.replaceOne(
... {_id: objectId,
... name: "this Better",
... address: "my house, in the middle of my street",
... cuisine: "eclectic"}
... );
2018-08-31T10:10:18.130-0700 E QUERY [js] TypeError: can't convert undefined to object :
DBCollection.prototype.replaceOne@src/mongo/shell/crud_api.js:460:16
@(shell):1:1
> db.restaurants.replaceOne( {_id: objectId},{ name: "this Better"}, {address: "my house, in the middle of my street"}, {cuisine: "eclectic"} );
{ "acknowledged" : true, "matchedCount" : 1, "modifiedCount" : 1 }
> db.restaurants.findOne({_id: objectId})
{ "_id" : ObjectId("59074c7c057aaffaafb0da64"), "name" : "this Better" }
> db.restaurants.findOne({_id: objectId})
{ "_id" : ObjectId("59074c7c057aaffaafb0da64"), "name" : "this Better" }
> db.restaurants.replaceOne(
... {_id: objectId},
... {name: "bizz Bar Bang"}
... );
{ "acknowledged" : true, "matchedCount" : 1, "modifiedCount" : 1 }
> db.restaurants.findOne(_id: objectId});
2018-08-31T10:17:40.204-0700 E QUERY [js] SyntaxError: missing ) after argument list @(shell):1:26
> db.restaurants.findOne({_id: objectId});
{ "_id" : ObjectId("59074c7c057aaffaafb0da64"), "name" : "bizz Bar Bang" }
> db.restaurants.find({"address.zipcode": "10035"}, {name: 1, "address.zipcode": 1})
{ "_id" : ObjectId("59074c7c057aaffaafb0e009"), "address" : { "zipcode" : "10035" }, "name" : "Sisters Cuisine" }
{ "_id" : ObjectId("59074c7c057aaffaafb0ea7e"), "address" : { "zipcode" : "10035" }, "name" : "Pipo's No 2 Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0fa3b"), "address" : { "zipcode" : "10035" }, "name" : "Gran Piatto D'Oro" }
{ "_id" : ObjectId("59074c7c057aaffaafb0fd4f"), "address" : { "zipcode" : "10035" }, "name" : "Don Paco Lopez Panaderia" }
{ "_id" : ObjectId("59074c7c057aaffaafb103ae"), "address" : { "zipcode" : "10035" }, "name" : "Courtside Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb11458"), "address" : { "zipcode" : "10035" }, "name" : "Agua Fresca- Tapas Bar El Kallejon" }
{ "_id" : ObjectId("59074c7c057aaffaafb11729"), "address" : { "zipcode" : "10035" }, "name" : "El Nuevo Sandy Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb117fc"), "address" : { "zipcode" : "10035" }, "name" : "Sabor Borinqueno # 2" }
{ "_id" : ObjectId("59074c7c057aaffaafb11ab8"), "address" : { "zipcode" : "10035" }, "name" : "Lucky's Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb11b79"), "address" : { "zipcode" : "10035" }, "name" : "Pizza And French Taste Pizzeria" }
{ "_id" : ObjectId("59074c7c057aaffaafb12000"), "address" : { "zipcode" : "10035" }, "name" : "Harlem Gourmet Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb120d0"), "address" : { "zipcode" : "10035" }, "name" : "China King" }
> db.restaurants.replace(
... {"address.zipcode": "10035",
... "address.zipcode": "10036"}
...
...
> db.restaurants.replace(
... {"address.zipcode": "10035"},
... {"address.zipcode": "10036"}
... );
2018-08-31T10:23:02.040-0700 E QUERY [js] TypeError: db.restaurants.replace is not a function :
@(shell):1:1
> db.restaurants.replaceOne(
... {"address.zipcode": "10035"},
... {"address.zipcode": "10036"}
... );
{ "acknowledged" : true, "matchedCount" : 1, "modifiedCount" : 1 }
> db.restaurants.find({"address.zipcode": "10035"}, {name: 1, "address.zipcode": 1})
{ "_id" : ObjectId("59074c7c057aaffaafb0ea7e"), "address" : { "zipcode" : "10035" }, "name" : "Pipo's No 2 Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0fa3b"), "address" : { "zipcode" : "10035" }, "name" : "Gran Piatto D'Oro" }
{ "_id" : ObjectId("59074c7c057aaffaafb0fd4f"), "address" : { "zipcode" : "10035" }, "name" : "Don Paco Lopez Panaderia" }
{ "_id" : ObjectId("59074c7c057aaffaafb103ae"), "address" : { "zipcode" : "10035" }, "name" : "Courtside Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb11458"), "address" : { "zipcode" : "10035" }, "name" : "Agua Fresca- Tapas Bar El Kallejon" }
{ "_id" : ObjectId("59074c7c057aaffaafb11729"), "address" : { "zipcode" : "10035" }, "name" : "El Nuevo Sandy Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb117fc"), "address" : { "zipcode" : "10035" }, "name" : "Sabor Borinqueno # 2" }
{ "_id" : ObjectId("59074c7c057aaffaafb11ab8"), "address" : { "zipcode" : "10035" }, "name" : "Lucky's Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb11b79"), "address" : { "zipcode" : "10035" }, "name" : "Pizza And French Taste Pizzeria" }
{ "_id" : ObjectId("59074c7c057aaffaafb12000"), "address" : { "zipcode" : "10035" }, "name" : "Harlem Gourmet Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb120d0"), "address" : { "zipcode" : "10035" }, "name" : "China King" }
> var zips = db.restaurants.find({"address.zipcode": "10035"}, {name: 1, "address.zipcode": 1});
> db.restaurants.update(
... {"address.zipcode": "10035"},
... {"address.zipcode": "10036"}
... );
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
> var zips = db.restaurants.find({"address.zipcode": "10035"}, {name: 1, "address.zipcode": 1});
> db.restaurants.find({"address.zipcode": "10035"}, {name: 1, "address.zipcode": 1})
{ "_id" : ObjectId("59074c7c057aaffaafb0fa3b"), "address" : { "zipcode" : "10035" }, "name" : "Gran Piatto D'Oro" }
{ "_id" : ObjectId("59074c7c057aaffaafb0fd4f"), "address" : { "zipcode" : "10035" }, "name" : "Don Paco Lopez Panaderia" }
{ "_id" : ObjectId("59074c7c057aaffaafb103ae"), "address" : { "zipcode" : "10035" }, "name" : "Courtside Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb11458"), "address" : { "zipcode" : "10035" }, "name" : "Agua Fresca- Tapas Bar El Kallejon" }
{ "_id" : ObjectId("59074c7c057aaffaafb11729"), "address" : { "zipcode" : "10035" }, "name" : "El Nuevo Sandy Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb117fc"), "address" : { "zipcode" : "10035" }, "name" : "Sabor Borinqueno # 2" }
{ "_id" : ObjectId("59074c7c057aaffaafb11ab8"), "address" : { "zipcode" : "10035" }, "name" : "Lucky's Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb11b79"), "address" : { "zipcode" : "10035" }, "name" : "Pizza And French Taste Pizzeria" }
{ "_id" : ObjectId("59074c7c057aaffaafb12000"), "address" : { "zipcode" : "10035" }, "name" : "Harlem Gourmet Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb120d0"), "address" : { "zipcode" : "10035" }, "name" : "China King" }
> db.restaurants.updateMany( {"address.zipcode": "10035"}, {$set: {"address.zipcode": "10036"}} );
{ "acknowledged" : true, "matchedCount" : 10, "modifiedCount" : 10 }
> db.restaurants.find({"address.zipcode": "10035"}, {name: 1, "address.zipcode": 1})
>
> db.restaurants.find({"address.zipcode": "10036"}, {name: 1, "address.zipcode": 1})
{ "_id" : ObjectId("59074c7c057aaffaafb0da60"), "address" : { "zipcode" : "10036" }, "name" : "Joe Allen Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0db32"), "address" : { "zipcode" : "10036" }, "name" : "West Bank Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dc33"), "address" : { "zipcode" : "10036" }, "name" : "Cafe Edison" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dc3f"), "address" : { "zipcode" : "10036" }, "name" : "Lattanzi" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dcb4"), "address" : { "zipcode" : "10036" }, "name" : "La Rivista Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dd12"), "address" : { "zipcode" : "10036" }, "name" : "Orso" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dd79"), "address" : { "zipcode" : "10036" }, "name" : "Da Rosina Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dd9a"), "address" : { "zipcode" : "10036" }, "name" : "Becco" }
{ "_id" : ObjectId("59074c7c057aaffaafb0de52"), "address" : { "zipcode" : "10036" }, "name" : "Europa Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0dea3"), "address" : { "zipcode" : "10036" }, "name" : "Smiler's" }
{ "_id" : ObjectId("59074c7c057aaffaafb0df09"), "address" : { "zipcode" : "10036" }, "name" : "Bali Nusa Indonesian Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0df1b"), "address" : { "zipcode" : "10036" }, "name" : "The Century Association" }
{ "_id" : ObjectId("59074c7c057aaffaafb0df16"), "address" : { "zipcode" : "10036" }, "name" : "Blake & Todd" }
{ "_id" : ObjectId("59074c7c057aaffaafb0df87"), "address" : { "zipcode" : "10036" }, "name" : "Schoenfield" }
{ "_id" : ObjectId("59074c7c057aaffaafb0df82"), "address" : { "zipcode" : "10036" }, "name" : "Bernard B Jacobs Theater" }
{ "_id" : ObjectId("59074c7c057aaffaafb0df81"), "address" : { "zipcode" : "10036" }, "name" : "Majestic Theater" }
{ "_id" : ObjectId("59074c7c057aaffaafb0df90"), "address" : { "zipcode" : "10036" }, "name" : "Minskoff Theater" }
{ "_id" : ObjectId("59074c7c057aaffaafb0df8e"), "address" : { "zipcode" : "10036" }, "name" : "Richard Rogers Theatre" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e003"), "address" : { "zipcode" : "10036" }, "name" : "Mcquaids Public House" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e0e1"), "address" : { "zipcode" : "10036" }, "name" : "Birdland" }
Type "it" for more
> it
{ "_id" : ObjectId("59074c7c057aaffaafb0e0ef"), "address" : { "zipcode" : "10036" }, "name" : "Flik International" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e10e"), "address" : { "zipcode" : "10036" }, "name" : "Town Hall Theatre" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e1b9"), "address" : { "zipcode" : "10036" }, "name" : "John's Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e235"), "address" : { "zipcode" : "10036" }, "name" : "Rick's Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e2b6"), "address" : { "zipcode" : "10036" }, "name" : "Playwright Celtic Pub" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e27d"), "address" : { "zipcode" : "10036" }, "name" : "42Nd Street Pizza Diner" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e2d1"), "address" : { "zipcode" : "10036" }, "name" : "Point Break" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e363"), "address" : { "zipcode" : "10036" }, "name" : "New Amsterdam Theater" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e39c"), "address" : { "zipcode" : "10036" }, "name" : "Turkish Cuisine" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e432"), "address" : { "zipcode" : "10036" }, "name" : "Skadden Arps, Slate" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e405"), "address" : { "zipcode" : "10036" }, "name" : "Belasco Theatre" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e510"), "address" : { "zipcode" : "10036" }, "name" : "Esca" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e58e"), "address" : { "zipcode" : "10036" }, "name" : "Intermisson Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e591"), "address" : { "zipcode" : "10036" }, "name" : "Crossroads (Marriott Marquis)" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e5cc"), "address" : { "zipcode" : "10036" }, "name" : "B. Smith Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e611"), "address" : { "zipcode" : "10036" }, "name" : "Tobacco Road" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e699"), "address" : { "zipcode" : "10036" }, "name" : "Brasserie Athenee" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e6eb"), "address" : { "zipcode" : "10036" }, "name" : "Kosher Deluxe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e6fd"), "address" : { "zipcode" : "10036" }, "name" : "Db Bistro Moderne" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e6a7"), "address" : { "zipcode" : "10036" }, "name" : "Queen Of Sheba Ethiopian Restaurant" }
Type "it" for more
> it
{ "_id" : ObjectId("59074c7c057aaffaafb0e72f"), "address" : { "zipcode" : "10036" }, "name" : "Reuters Executive Dining Room" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e718"), "address" : { "zipcode" : "10036" }, "name" : "Lucky Star Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e86b"), "address" : { "zipcode" : "10036" }, "name" : "Canard Inc" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e866"), "address" : { "zipcode" : "10036" }, "name" : "Danny's Deli" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e889"), "address" : { "zipcode" : "10036" }, "name" : "Ernst & Young Cafe" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e923"), "address" : { "zipcode" : "10036" }, "name" : "Big Apple Deli" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e973"), "address" : { "zipcode" : "10036" }, "name" : "Broadway Deli & Bagel's" }
{ "_id" : ObjectId("59074c7c057aaffaafb0e99c"), "address" : { "zipcode" : "10036" }, "name" : "Tulcingo Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0eb2b"), "address" : { "zipcode" : "10036" }, "name" : "Pax Wholesome Foods" }
{ "_id" : ObjectId("59074c7c057aaffaafb0ebbf"), "address" : { "zipcode" : "10036" }, "name" : "Conde Nast" }
{ "_id" : ObjectId("59074c7c057aaffaafb0ec62"), "address" : { "zipcode" : "10036" }, "name" : "Harold & Miriam Steinberg Center For Theatre" }
{ "_id" : ObjectId("59074c7c057aaffaafb0ec94"), "address" : { "zipcode" : "10036" }, "name" : "Little Italy Pizza" }
{ "_id" : ObjectId("59074c7c057aaffaafb0ed1b"), "address" : { "zipcode" : "10036" }, "name" : "Akdeniz" }
{ "_id" : ObjectId("59074c7c057aaffaafb0ed87"), "address" : { "zipcode" : "10036" }, "name" : "Villa" }
{ "_id" : ObjectId("59074c7c057aaffaafb0efd7"), "address" : { "zipcode" : "10036" }, "name" : "Wichcraft Express" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f1d9"), "address" : { "zipcode" : "10036" }, "name" : "Nios Restaurant" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f3ee"), "address" : { "zipcode" : "10036" }, "name" : "Landsdowne Road" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f467"), "address" : { "zipcode" : "10036" }, "name" : "The Perfect Pint" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f71a"), "address" : { "zipcode" : "10036" }, "name" : "P.D. O'Hurley's" }
{ "_id" : ObjectId("59074c7c057aaffaafb0f9ce"), "address" : { "zipcode" : "10036" }, "name" : "Bourbon Street Bar And Grille" }
Type "it" for more
> db.restaurants.findOne({_id: "59074c7c057aaffaafb0e009"})
null
> db.restaurants.findOne({name: "Courtside Cafe"})
{
"_id" : ObjectId("59074c7c057aaffaafb103ae"),
"address" : {
"building" : "1",
"coord" : [
-73.9196946,
40.7931957
],
"street" : "Randalls Island",
"zipcode" : "10036"
},
"borough" : "Manhattan",
"cuisine" : "Café/Coffee/Tea",
"grades" : [
{
"date" : ISODate("2014-06-19T00:00:00Z"),
"grade" : "A",
"score" : 11
},
{
"date" : ISODate("2013-05-11T00:00:00Z"),
"grade" : "A",
"score" : 12
},
{
"date" : ISODate("2012-05-07T00:00:00Z"),
"grade" : "A",
"score" : 7
},
{
"date" : ISODate("2011-11-03T00:00:00Z"),
"grade" : "A",
"score" : 10
}
],
"name" : "Courtside Cafe",
"restaurant_id" : "41451410"
}
> db.restaurants.findOne({name: "Sisters Cuisine"})
null
> db.restaurants.findOne({name: "Pipo's No 2 Restaurant"})
null
> db.restaurants.findOne({name: "Gran Piatto D'Oro"})
{
"_id" : ObjectId("59074c7c057aaffaafb0fa3b"),
"address" : {
"building" : "1429",
"coord" : [
-73.94583949999999,
40.8010305
],
"street" : "5 Avenue",
"zipcode" : "10036"
},
"borough" : "Manhattan",
"cuisine" : "Italian",
"grades" : [
{
"date" : ISODate("2014-11-26T00:00:00Z"),
"grade" : "B",
"score" : 20
},
{
"date" : ISODate("2014-05-14T00:00:00Z"),
"grade" : "A",
"score" : 12
},
{
"date" : ISODate("2013-08-21T00:00:00Z"),
"grade" : "B",
"score" : 26
},
{
"date" : ISODate("2013-01-15T00:00:00Z"),
"grade" : "A",
"score" : 0
},
{
"date" : ISODate("2012-08-02T00:00:00Z"),
"grade" : "A",
"score" : 12
},
{
"date" : ISODate("2012-02-08T00:00:00Z"),
"grade" : "C",
"score" : 54
}
],
"name" : "Gran Piatto D'Oro",
"restaurant_id" : "41318313"
}
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment