mongoDB modify data

1. Change qualified first document

  • db collection name .update. ({conditions: "Condition value"}, {$ set: {Modify Attribute: modified value}})
  • The first parameter is the condition , the second parameter is modified content .
  • You can change more, it is to continue to modify the input after the second argument in the form of the object content on it
    Here Insert Picture Description
  • The modified content
    Here Insert Picture Description

2. Modify integrity

  • It is to modify the contents of all the information you entered
    Here Insert Picture Description
    modified result:
    Here Insert Picture Description
    you can see all the content you enter becomes the value of the

3. The specified numeric type addition and subtraction operation

  • db collection name .update ({condition name: "condition value"}, {$ inc: {modify property values: +/- many}}).
    $ inc is: {}
    Here Insert Picture Description
    successfully modified line of data affected

Modify the result of:
Here Insert Picture Description

Published 19 original articles · won praise 5 · Views 285

Guess you like

Origin blog.csdn.net/qq_44163269/article/details/104913807