Python Tutorials · Python MongoDB
MongoDB Update
Learn all about MongoDB Update in this comprehensive tutorial.
5 min read advanced
- •You can update a record, or document as it is called in MongoDB, by using the update_one() method.
- •To update all documents that meets the criteria of the query, use the update_many() method.
Update Collection
You can update a record, or document as it is called in MongoDB, by using the update_one() method.
The first parameter of the update_one() method is a query object defining which document to update.
Note: Note: If the query finds more than one record, only the first
occurrence is updated.
The second parameter is an object defining the new values of the document.
python
Update Many
To update all documents that meets the criteria of the query, use the update_many() method.
python
Module quiz
2 questions1
Which of the following is true about MongoDB Update?
2
What is the most common pitfall when working with MongoDB Update?
Answer all questions to submit.