using MongoDB.Bson; using MongoDB.Driver; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; namespace MongoDb.Ado.data { public class DeleteHandlerAsync : IMongoOperationHandlerAsync { public async Task HandleAsync(IMongoCollection collection, string json) { var doc = BsonDocument.Parse(json); var filter = doc["filter"].AsBsonDocument; var result =await collection.DeleteOneAsync(filter); return (int)result.DeletedCount; } } }