mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-09 19:04:58 +08:00
Update mongodb
This commit is contained in:
@@ -80,7 +80,7 @@ namespace SqlSugar.MongoDb
|
||||
throw new Exception("Expressions are not supported." + lambda.ToString());
|
||||
}
|
||||
|
||||
// 生成 $expr 查询,增加 $ifNull 逻辑
|
||||
// 生成 $expr 查询,兼容 null 和空集合
|
||||
var expr = new BsonDocument
|
||||
{
|
||||
{
|
||||
@@ -100,6 +100,14 @@ namespace SqlSugar.MongoDb
|
||||
{ "input", $"${collectionField2}" },
|
||||
{ "as", paramName },
|
||||
{ "cond", new BsonDocument
|
||||
{
|
||||
{ "$and", new BsonArray
|
||||
{
|
||||
new BsonDocument
|
||||
{
|
||||
{ "$isArray", $"$${paramName}.{nestedCollectionField}" }
|
||||
},
|
||||
new BsonDocument
|
||||
{
|
||||
{ "$gt", new BsonArray
|
||||
{
|
||||
@@ -125,6 +133,9 @@ namespace SqlSugar.MongoDb
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user