Update mongodb

This commit is contained in:
sunkaixuan 2025-06-23 20:52:01 +08:00
parent b8d1ae414d
commit fb319f9e13
2 changed files with 5 additions and 1 deletions

View File

@ -18,6 +18,10 @@ namespace MongoDbTest
var data1=db.Queryable<Student>().ToList();
if (data1.First().Book.Count != 1) Cases.ThrowUnitError();
if (data1.First().Book.First().Price != 21) Cases.ThrowUnitError();
data1.First().Book.First().Price = 100;
db.Updateable(data1).ExecuteCommand();
var data2 = db.Queryable<Student>().ToList();
if (data2.First().Book.First().Price != 100) Cases.ThrowUnitError();
}
[SqlSugar.SugarTable("UnitStudentdfsds3zzz1")]

View File

@ -123,7 +123,7 @@ namespace SqlSugar.MongoDb
{
if (col.IsJson)
{
var bsonValue = BsonDocument.Parse(col.Value?.ToString());
var bsonValue = UtilMethods.ParseJsonObject(col.Value?.ToString());
setDoc[col.DbColumnName] = bsonValue;
}
else