mongodb-csharp CRUD Operations in MongoDB C# Update a Document


Example

var client = new MongoClient("mongodb://localhost:27017"); var database = client.GetDatabase("test"); var collection = database.GetCollection < Interactions > ("Interactions");

var update = MongoDB.Driver .Builders .Update.Set(s => s.SiteName, "New Example");

collection.FindOneAndUpdate(s => s.SiteName == "Example", update);