Skip to main content

UpdateOneAsync() in C# with MongoDB

UpdateOneAsync is used in .net 4.5 and later versions for updating one record in MongoDB. Even if your selecting matches multiple records it will update only first record of the data.


Example:

var updoneresult = await collection.UpdateOneAsync(
                   Builders<BsonDocument>.Filter.Eq("MasterID", 10),
                   Builders<BsonDocument>.Update.Set("MasterID", 11));



Comments

  1. like Eq("MasterID", 10) i have two condition to check . so what shoud i write

    ReplyDelete

Post a Comment