Created
October 9, 2018 23:26
-
-
Save rjwilliams87/e2974396e89517d1c86f1461f8d1ebc7 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
Get All: db.restaurants.find(); | |
Limit and Sort: db.restaurants.find().sort({name:1}).limit(10); | |
Get by _id: db.restaurants.findOne({_id: ObjectId(...)}); | |
Get by value: db.restaurants.find({borough: "Queens"}); | |
Count: db.restaurants.count(); | |
Count by nested value: db.restaurants.count({"address.zipcode" : "11206}); | |
Delet by Id: db.restaurants.remove({_id: ObjectId(...)}); | |
Update a single document: db.restaurants.update({_id: ObjectId(...)}, {$set: {name: "Foo Bar Bizz Buzz"}}); | |
Update many documents: 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