Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Get All: db.restaurants.find()
- Limit and Sort: db.restaurants. find(). sort({name:1}). limit(10);
- Get by _id: db.restaurants.find({_id: ObjectId("58d7e927ab39e63a7e88a95f")});
- Get by Value: restaurantSchema.virtual('addressString').get(function() {
- Count: db.restaurants.count()
- Count by nested value: db.restaurants.find( { "address.zipcode": "11206" } ).count()
- Delete by id: db.restaurants.remove({_id: ObjectId("58d7e927ab39e63a7e88a95f")});
- Update a single document: db.restaurants.updateOne( {_id: ObjectId("58d7e927ab39e63a7e88a960")}, {$set: {name: "Bizz Bar Bang"}});
- Update many: db.restaurants.updateMany( { "address.zipcode": "10035" }, { $set: { "address.zipcode": "11036" } } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement