mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Update mongodb
This commit is contained in:
parent
8c177909d7
commit
02a7772402
@ -28,7 +28,13 @@ namespace MongoDbTest
|
|||||||
if (count3 != 1) Cases.ThrowUnitError();
|
if (count3 != 1) Cases.ThrowUnitError();
|
||||||
var rows3 = db.Deleteable<Student>().In(db.Queryable<Student>().First().Id).ExecuteCommandAsync().GetAwaiter().GetResult();
|
var rows3 = db.Deleteable<Student>().In(db.Queryable<Student>().First().Id).ExecuteCommandAsync().GetAwaiter().GetResult();
|
||||||
var count4 = db.Queryable<Student>().Count();
|
var count4 = db.Queryable<Student>().Count();
|
||||||
if (count4 !=0) Cases.ThrowUnitError();
|
if (count4 !=0) Cases.ThrowUnitError();
|
||||||
|
db.Insertable(new List<Student>() {
|
||||||
|
new Student() { Age = 2, Name = "aa", SchoolId = "222", CreateDateTime = DateTime.Now.AddDays(-1) },
|
||||||
|
new Student() { Age = 3, Name = "33", SchoolId = "333", CreateDateTime = DateTime.Now.AddDays(1) }
|
||||||
|
}).ExecuteCommandAsync().GetAwaiter().GetResult();
|
||||||
|
var id2 =db.Queryable<Student>().First(it => it.Name.ToLower() == "a")?.Id??null;
|
||||||
|
db.Deleteable<Student>().In(id).ExecuteCommandAsync().GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
[SqlSugar.SugarTable("UnitStudent1ssdds3z1")]
|
[SqlSugar.SugarTable("UnitStudent1ssdds3z1")]
|
||||||
public class Student : MongoDbBase
|
public class Student : MongoDbBase
|
||||||
|
@ -486,6 +486,20 @@ namespace SqlSugar.MongoDb
|
|||||||
throw new NotSupportedException("ToString 只支持0或1个参数");
|
throw new NotSupportedException("ToString 只支持0或1个参数");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public override string ToUpper(MethodCallExpressionModel model)
|
||||||
|
{
|
||||||
|
var item = model.DataObject as Expression;
|
||||||
|
BsonValue memberName = new ExpressionVisitor(context).Visit(item as Expression);
|
||||||
|
var toUpperDoc = new BsonDocument("$toUpper", $"${memberName}");
|
||||||
|
return toUpperDoc.ToJson(UtilMethods.GetJsonWriterSettings());
|
||||||
|
}
|
||||||
|
public override string ToLower(MethodCallExpressionModel model)
|
||||||
|
{
|
||||||
|
var item = model.DataObject as Expression;
|
||||||
|
BsonValue memberName = new ExpressionVisitor(context).Visit(item as Expression);
|
||||||
|
var toLowerDoc = new BsonDocument("$toLower", $"${memberName}");
|
||||||
|
return toLowerDoc.ToJson(UtilMethods.GetJsonWriterSettings());
|
||||||
|
}
|
||||||
|
|
||||||
#region
|
#region
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user