␡
- Inserting Data
- Reading Data
- Updating Data
- Removing Data
- Conclusion
Like this article? We recommend
Updating Data
To update data, you can use the update() method. Here is a simple update query:
db.testData.update({name: “Jacks Teller”},{$set: {age: 37}})
After performing the operation above, you should see the following result:
WriteResult({ “nMatched” : 1, “nUpserted” : 0, “nModified” : 1 })
The status result indicates that one matching document was found and modified. No documents were Upserted, which means that the document is added to the collection if no matches are found.