MongoDB Update Document
Use db.collection.update() method to update document in MongoDB database.
Syntax:
Find Current Document
First, find the current document in collection with user_name = rahul. We have already inserted documents in the previous tutorial like below.
Update Document
Now change location from India to Australia for the document where id = 1001.
Output: WriteResult({ “nMatched” : 1, “nUpserted” : 0, “nModified” : 1 })
0 Comments
CAN FEEDBACK
Emoji