Upddate mongodb

This commit is contained in:
sunkaixuan
2025-06-10 17:46:57 +08:00
parent 6afa9f7539
commit b41076f0b0
12 changed files with 34 additions and 13 deletions

View File

@@ -3,18 +3,20 @@ using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace MongoDb.Ado.data
{
public class DeleteHandlerAsync : IMongoOperationHandlerAsync
{
public CancellationToken token { get; set; }
public string operation { get; set; }
public async Task<int> HandleAsync(IMongoCollection<BsonDocument> collection, string json)
{
var doc = BsonDocument.Parse(json);
var filter = doc["filter"].AsBsonDocument;
var result =await collection.DeleteOneAsync(filter);
var result =await collection.DeleteOneAsync(filter,token);
return (int)result.DeletedCount;
}
}