mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
Update mongodb
This commit is contained in:
@@ -77,6 +77,11 @@ namespace MongoDbTest
|
||||
var ids2 = db.Queryable<Student>().Select(it => it.Id).ToList();
|
||||
var list73 = db.Queryable<Student>().Where(it => ids2.Contains(it.Id)).ToList();
|
||||
if (list73.Count != ids2.Count) Cases.ThrowUnitError();
|
||||
|
||||
|
||||
string [] ids3 = db.Queryable<Student>().Select(it => it.Id).ToArray();
|
||||
var list74 = db.Queryable<Student>().Where(it => ids3.Contains(it.Id)).ToList();
|
||||
if (list74.Count != ids2.Count) Cases.ThrowUnitError();
|
||||
}
|
||||
|
||||
private static void ValidateStudentData(SqlSugar.SqlSugarClient db)
|
||||
|
@@ -100,6 +100,13 @@ namespace SqlSugar.MongoDb
|
||||
{
|
||||
name = "ContainsArray";
|
||||
}
|
||||
else if (name == "Contains" && methodCallExpression.Arguments.Count ==2
|
||||
&& methodCallExpression.Arguments.FirstOrDefault().Type.IsArray
|
||||
&& ExpressionTool.GetParameters(methodCallExpression.Arguments.FirstOrDefault()).Count == 0
|
||||
)
|
||||
{
|
||||
name = "ContainsArray";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
@@ -599,6 +599,11 @@ namespace SqlSugar.MongoDb
|
||||
// 解析数组表达式和待判断的元素表达式
|
||||
var arrayExp = model.DataObject as Expression;
|
||||
var itemExp = model.Args[0].MemberValue as Expression;
|
||||
if (arrayExp == null)
|
||||
{
|
||||
arrayExp = model.Args[0].MemberValue as Expression;
|
||||
itemExp = model.Args[1].MemberValue as Expression;
|
||||
}
|
||||
|
||||
// 获取字段名
|
||||
BsonValue fieldName = new ExpressionVisitor(context).Visit(itemExp);
|
||||
|
Reference in New Issue
Block a user