Docs Home → Develop Applications → MongoDB Drivers → C#/.NET
Update Many Documents
You can update more than one document using the UpdateMany()
method on
a collection object.
Example
The following code updates all documents in the restaurants
collection that have a
cuisine
field with the value of "Pizza". After the update, these documents will
have a cuisine
field with a value of "Pasta and breadsticks".
Select the Asynchronous or Synchronous tab to see the corresponding code.
Expected Result
Running either of the preceding full examples prints the following results:
Restaurants with cuisine "Pizza" found: 1163 Restaurants modified by update: 1163 Restaurants with cuisine "Pasta and breadsticks" found after update: 1163 Resetting sample data...done.
More Information
To learn more about updating documents, see the Modify Documents guide.
To learn more about using builders, see Operations with Builders.