mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-21 02:58:05 +08:00
HandlePipelineUpdate
This commit is contained in:
@@ -57,7 +57,7 @@ namespace MongoDb.Ado.data
|
||||
return new List<BsonDocument> { BsonDocument.Parse(json) };
|
||||
}
|
||||
|
||||
private static async Task<int> HandlePipelineUpdate(IMongoCollection<BsonDocument> collection, BsonDocument filter, BsonDocument update)
|
||||
private async Task<int> HandlePipelineUpdate(IMongoCollection<BsonDocument> collection, BsonDocument filter, BsonDocument update)
|
||||
{
|
||||
// 构造pipeline update
|
||||
// 构造pipeline update,不写死,循环现有的$set值
|
||||
@@ -81,8 +81,16 @@ namespace MongoDb.Ado.data
|
||||
};
|
||||
var pipelineUpdate = new PipelineUpdateDefinition<BsonDocument>(updatePipeline);
|
||||
|
||||
var result =await collection.UpdateManyAsync(filter, pipelineUpdate);
|
||||
return (int)result.ModifiedCount;
|
||||
if (context.IsAnyServerSession)
|
||||
{
|
||||
var result = await collection.UpdateManyAsync(context.ServerSession,filter, pipelineUpdate);
|
||||
return (int)result.ModifiedCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = await collection.UpdateManyAsync(filter, pipelineUpdate);
|
||||
return (int)result.ModifiedCount;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsUpateBySql(BsonDocument update)
|
||||
|
Reference in New Issue
Block a user