
The MongoDB shell provides the following methods to update documents in a collection:
To update a single document, use db.collection.updateOne()
To update multiple documents, use db.collection.updateMany()
To replace a document, use db.collection.replaceOne()
Sources:
Update Documents — MongoDB Shell. www.mongodb.com/docs/mongodb-shell/crud/update.
About the author
Full Stack Developer with a passion for building web applications. PHP, Node.js, Laravel, MySQL, MongoDB. Love collaborating & making a difference
Comments
Join the discussionNo comments yet. Be the first to comment.




