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));