From the course: MongoDB C# Developer Associate Cert Prep
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Updating documents in C# applications - MongoDB Tutorial
From the course: MongoDB C# Developer Associate Cert Prep
Updating documents in C# applications
- Welcome. In this video, you'll learn about the UpdateOne and UpdateMany methods. You'll also learn how to use the .NET framework's LINQ syntax with the driver's builder class to create filter and update definitions. Two ways we can update a document in MongoDB are to update the value of an existing field or to define a new field and value. Note that this is not an exhaustive list of the available update operations. Let's look at a few examples of updating documents to understand how updating works. In this example, we'll set the balance of a specified account to 5,000. We define a MongoDB collection object called accounts collection. Then we create a filter definition, with the filter method on the builders class. This returns the account with an account ID equal to MDB951086017. Next we create an update definition, which will set the balance to 5,000. Finally, we call the UpdateOne method, and pass in the…
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Working with MongoDB documents in C#3m 11s
-
(Locked)
Inserting a document in C# applications3m 41s
-
(Locked)
Querying a MongoDB collection in C# applications4m 12s
-
(Locked)
Updating documents in C# applications4m 35s
-
(Locked)
Deleting documents in C# applications4m 25s
-
(Locked)
Creating MongoDB transactions in C# applications3m 11s
-
(Locked)
MongoDB CRUD operations in C# review1m 3s
-
(Locked)
-
-
-
-
-
-
-