From the course: MongoDB Python Developer Associate Cert Prep
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Updating MongoDB documents by using updateMany()
From the course: MongoDB Python Developer Associate Cert Prep
Updating MongoDB documents by using updateMany()
- Hello! In this video you'll learn how to update multiple documents in a single MongoDB collection by using the updateMany() method. The updateMany() method accepts a filter document, an update document and an options object. The options object is not required and we won't use it in this video. The filter document contains the selection criteria for the update. In this example, "year: 2022", is the filter document within the updateMany() method. The update document contains the modifications to apply to all documents that match the filter. Imagine that we want to update all the books in a collection that meets certain criteria. We can use the updateMany() method to do this. Here's one document from the Books collection. It includes information about a single book including fields like '_id', 'title', 'published date', 'status' and 'authors'. We'll use updateMany() to update all documents that were published before…
Contents
-
-
-
-
-
-
-
(Locked)
Replacing a document in MongoDB3m 15s
-
(Locked)
Updating MongoDB documents by using updateOne()5m 56s
-
Updating MongoDB documents by using findAndModify()2m 35s
-
(Locked)
Updating MongoDB documents by using updateMany()3m 2s
-
(Locked)
Deleting documents in MongoDB2m 37s
-
(Locked)
MongoDB CRUD operations: replace and delete documents review44s
-
(Locked)
-
-
-
-
-
-
-
-
-