mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-27 19:41:17 +08:00
Update mongodb
This commit is contained in:
parent
a65c2740c3
commit
feb5d298e1
@ -31,12 +31,38 @@ namespace MongoDbTest
|
||||
db.Updateable(db.Queryable<Student>().First(it => it.SchoolId == ids.Last())).ExecuteCommand();
|
||||
if (db.Queryable<Student>().First(it => it.SchoolId == ids.Last()).Name != "TestStudent") Cases.ThrowUnitError();
|
||||
|
||||
//var list=db.Queryable<Student>()
|
||||
// .LeftJoin<School>((x, y) => x.SchoolId == y.Id)
|
||||
// .Where((x,y)=>x.Name =="a"||y.Name=="a")
|
||||
// .Select(x => new
|
||||
var adoTest= db.Ado.GetDataTable(@"aggregate UnitStudent123131 [
|
||||
{
|
||||
$lookup: {
|
||||
from: ""UnitSchool123131"",
|
||||
localField: ""SchoolId"",
|
||||
foreignField: ""_id"",
|
||||
as: ""y""
|
||||
}
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: ""$y"",
|
||||
preserveNullAndEmptyArrays: true
|
||||
}
|
||||
},
|
||||
{
|
||||
$project: {
|
||||
_id: 0,
|
||||
StudentName: ""$Name"",
|
||||
SchoolName: {
|
||||
$ifNull: [""$y.Name"", null]
|
||||
}
|
||||
}
|
||||
}
|
||||
]");
|
||||
|
||||
//var list = db.Queryable<Student>()
|
||||
// .LeftJoin<School>((x, y) => x.SchoolId == y.Id)
|
||||
// .Select((x,y) => new
|
||||
// {
|
||||
// id=x.Name
|
||||
// StudentName= x.Name,
|
||||
// SchoolName= y.Name
|
||||
// }).ToList();
|
||||
}
|
||||
[SqlSugar.SugarTable("UnitStudent123131")]
|
||||
|
Loading…
Reference in New Issue
Block a user