mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 01:58:13 +08:00
Update mongodb
This commit is contained in:
@@ -79,7 +79,16 @@ namespace MongoDbTest
|
||||
studentName = s.Name,
|
||||
schoolName = sc.Name
|
||||
}).ToList();
|
||||
if (dt4.Last().studentName != "李四"|| dt4.Last().schoolName != "复旦大学") Cases.ThrowUnitError();
|
||||
if (dt4.Count==2&&dt4.Last().studentName != "李四"|| dt4.Last().schoolName != "复旦大学") Cases.ThrowUnitError();
|
||||
|
||||
// var dt6= 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 (dt6.Count==1&& dt6.Last().studentName != "李四" || dt6.Last().schoolName != "复旦大学") Cases.ThrowUnitError();
|
||||
}
|
||||
[SqlSugar.SugarTable("UnitStudentdu2s31")]
|
||||
public class Student : MongoDbBase
|
||||
|
@@ -197,9 +197,8 @@ namespace SqlSugar.MongoDb
|
||||
var joinWhereDoc = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>(item.JoinWhere);
|
||||
var isEasyJoin = !(this.JoinQueryInfoLets?.Any(s => s.Key.EqualCase(item.ShortName)) == true);
|
||||
var isExp = !isEasyJoin;
|
||||
var localField = isExp ? string.Empty : joinWhereDoc.GetElement(0).Name;
|
||||
var eqObj = isExp ? null : joinWhereDoc[localField].AsBsonDocument;
|
||||
var foreignField = isExp ? string.Empty : eqObj.GetElement(0).Value.AsString;
|
||||
var localField = isExp ? string.Empty : joinWhereDoc.GetElement(0).Value["$eq"][0]?.toString()?.TrimStart('$');
|
||||
var foreignField = isExp ?string.Empty: joinWhereDoc.GetElement(0).Value["$eq"][1]?.toString()?.TrimStart($"${item.ShortName}.".toCharArray());
|
||||
|
||||
string from = item.TableName ?? item.ShortName ?? "Unknown";
|
||||
string asName = item.ShortName;
|
||||
|
Reference in New Issue
Block a user