Skip to main content

UpdateManyAsync() in C# with MongoDB

UpdateManyAsync() is the function in .net 4.5 and later versions for updating one or more number of records in MongoDB. It will also updates one record if your selection matches only one record


var updmanyresult = await collection.UpdateManyAsync(
                  Builders<BsonDocument>.Filter.Gt("MasterID", 100),
                  Builders<BsonDocument>.Update.Inc("MasterID", 10));