From c775d69bfe708b05d0c84a7f63d88b0339b3f14c Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Thu, 14 Aug 2025 12:46:04 +0800 Subject: [PATCH] Update mongodb --- Src/Asp.NetCore2/MongoDbTest/UnitTest/QueryLeftJoin.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Src/Asp.NetCore2/MongoDbTest/UnitTest/QueryLeftJoin.cs b/Src/Asp.NetCore2/MongoDbTest/UnitTest/QueryLeftJoin.cs index d8bc5be9e..58382ecbd 100644 --- a/Src/Asp.NetCore2/MongoDbTest/UnitTest/QueryLeftJoin.cs +++ b/Src/Asp.NetCore2/MongoDbTest/UnitTest/QueryLeftJoin.cs @@ -13,7 +13,9 @@ namespace MongoDbTest internal static void Init() { var db = DbHelper.GetNewDb(); - db.DbMaintenance.TruncateTable(); + db.DbMaintenance.TruncateTable(); + + db.Insertable(new Student { Name = "jack" }).ExecuteCommand(); // 添加学校数据 var school = new School { Name = "TestSchool" }; var ids=db.Insertable(school).ExecuteReturnPkList(); @@ -24,9 +26,8 @@ namespace MongoDbTest var student2 = new Student { Name = "TestStudentNoSchool", SchoolId = ObjectId.GenerateNewId().ToString() }; + db.Insertable(student2).ExecuteCommand(); - - if (db.Queryable().First(it => it.SchoolId == ids.Last()).Name != "TestStudent") Cases.ThrowUnitError(); db.Updateable(db.Queryable().First(it => it.SchoolId == ids.Last())).ExecuteCommand(); if (db.Queryable().First(it => it.SchoolId == ids.Last()).Name != "TestStudent") Cases.ThrowUnitError();