Created
November 13, 2017 16:25
-
-
Save scottiedog45/b94fd5d4ff523c5e3a8b2e3b037a830d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
run mongo shell | |
db.restaurant.find(); | |
db.restaurants. | |
find(). | |
sort({name:1}). | |
limit(10); | |
var documentId = ObjectId('xxxxx'); | |
db.restaurants.findOne({_id: documentId}); | |
db.restaurants.find({bourough: "Queens"}); | |
db.collection.count(); | |
db.collection.find({'address.zipcode': "11206"}).count; | |
var documentId = ObjectId('xxxxx'); | |
db.restaurants.findOne({}, {_id: documentId})._id; | |
db.restaurants.removeOne(_id:documentId) | |
db.restaurants.updateOne( | |
{_id: documentId}, | |
{$set:{name: "Bizz Bar Bang"}} | |
); | |
db.restaurants.updateMany( | |
{'address.zipcode': "10035"}, | |
{$set:{'address.zipcode': "10036"}} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment