mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
Update mongodb
This commit is contained in:
@@ -91,6 +91,15 @@ namespace MongoDbTest
|
||||
}).ToList();
|
||||
if (dt6.Count != 1 || dt6.Last().studentName != "李四" || dt6.Last().schoolName != "复旦大学") Cases.ThrowUnitError();
|
||||
|
||||
|
||||
var dt7 = db.Queryable<Student>()
|
||||
.LeftJoin<School>((s, sc) => s.SchoolId == sc.Id && sc.Name == "复旦大学")
|
||||
.Select((s, sc) => new
|
||||
{
|
||||
studentName = s.Name,
|
||||
schoolName = sc.Name
|
||||
}).ToList();
|
||||
if (dt7.Count != 1 || dt7.Last().studentName != "李四" || dt7.Last().schoolName != "复旦大学") Cases.ThrowUnitError();
|
||||
}
|
||||
[SqlSugar.SugarTable("UnitStudentdu2s31")]
|
||||
public class Student : MongoDbBase
|
||||
|
@@ -263,7 +263,7 @@ namespace SqlSugar.MongoDb
|
||||
|
||||
// $unwind
|
||||
BsonValue unwindDoc = null;
|
||||
if (item.JoinType == JoinType.Left)
|
||||
if (item.JoinType == JoinType.Left&&isEasyJoin)
|
||||
{
|
||||
unwindDoc = new BsonDocument("$unwind", new BsonDocument
|
||||
{
|
||||
@@ -271,7 +271,14 @@ namespace SqlSugar.MongoDb
|
||||
{ "preserveNullAndEmptyArrays", true }
|
||||
});
|
||||
}
|
||||
else if (item.JoinType == JoinType.Inner)
|
||||
else if (item.JoinType == JoinType.Inner && isEasyJoin)
|
||||
{
|
||||
unwindDoc = new BsonDocument("$unwind", new BsonDocument
|
||||
{
|
||||
{ "path", $"${asName}" }
|
||||
});
|
||||
}
|
||||
else if (isExp)
|
||||
{
|
||||
unwindDoc = new BsonDocument("$unwind", new BsonDocument
|
||||
{
|
||||
|
Reference in New Issue
Block a user