DeleteOneAsync() in C# with Example

DeleteOneAsync is used in .Net 4.5 and later versions for deleting single record in MongoDB by using C#, We should add MongoDB reference for the working solution


Find the example below, Deleting data in MongoDB document with the exact match of  'MasterID' key as '140'.



var result = await collection.DeleteOneAsync(
                 Builders<BsonDocument>.Filter.Eq("MasterID", 140));