mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 18:48:09 +08:00
Update mongodb
This commit is contained in:
@@ -16,7 +16,14 @@ namespace MongoDb.Ado.data
|
||||
public async Task<int> HandleAsync(IMongoCollection<BsonDocument> collection, string json)
|
||||
{
|
||||
var doc = BsonDocument.Parse(json);
|
||||
await collection.InsertOneAsync(doc,null,token);
|
||||
if (context.IsAnyServerSession)
|
||||
{
|
||||
await collection.InsertOneAsync(context.ServerSession,doc, null, token);
|
||||
}
|
||||
else
|
||||
{
|
||||
await collection.InsertOneAsync(doc, null, token);
|
||||
}
|
||||
var objectId = doc["_id"].AsObjectId.ToString();
|
||||
context.ids = new string[] { objectId };
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user