1. Update
Db.persons.update ({name: "Caohui"},{id:2}); update only one, replace update directly
Db.persons.update ({name: "Caohui"},{id:2},true), update only one, replace update directly, insert if not present
2. Full-scale update
Db.persons.update ({name: "Caohui"},{$set: {id:2}},false,true); full-scale local update
3. $set {$set: {Field:value}}
It is used to specify a key value pair, if there is a key value is modified, does not exist to add
4. $inc {$inc: {Field:value}}
Only used with numeric types, you can add and subtract numeric types that correspond to the specified key
5. $unset {$unset: {field:1}} to delete the corresponding key value
6. $push {$push: {Field:value}}
Add data to the array, or create if the key does not exist
7. $pushAll {$push: {Field:[value]}}
Adding elements to an array in bulk
8. $addToSet {$addToSet: {Field:value}}
Add elements to the array, if present, without adding
9. $pop {$pop: {Field:value}}
Delete data to an array, 1 delete the last value;-1 Delete the first value
Ten. $pull {$pull: {Field:value}}
Deletes the value specified by the array
$pullAll {$pullAll: {Field:value}}
To delete multiple corresponding array values
12. Array Locator $
Db.books.update ({"Boook.type": "JS"},{$set: {"Boook.$.count": 222}})
MongoDB modifier (3)