SqlSugar/Src/Asp.NetCore2/MongoDb.Ado.data/ExecuteNonQueryItems/InsertHandler.cs
2025-05-02 07:54:16 +08:00

19 lines
424 B
C#

using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Text;
namespace MongoDb.Ado.data
{
public class InsertHandler : IMongoOperationHandler
{
public int Handle(IMongoCollection<BsonDocument> collection, string json)
{
var doc = BsonDocument.Parse(json);
collection.InsertOne(doc);
return 1;
}
}
}