mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 04:23:47 +08:00
Update mongodb
This commit is contained in:
@@ -21,6 +21,11 @@ namespace MongoDbTest
|
||||
var data2 = db.Queryable<Student>().Where(it => it.Book.Price == 1).ToList();
|
||||
if (data2.Count != 1) Cases.ThrowUnitError();
|
||||
if (data2.First().Book.Price != 1) Cases.ThrowUnitError();
|
||||
data2.First().Book.Price = 100;
|
||||
db.Updateable(data2).ExecuteCommand();
|
||||
var data3 = db.Queryable<Student>().Where(it => it.Book.Price == 100).ToList();
|
||||
if (data3.Count != 1) Cases.ThrowUnitError();
|
||||
if (data2.First().Book.Price != 100) Cases.ThrowUnitError();
|
||||
}
|
||||
|
||||
[SqlSugar.SugarTable("UnitStudentdfsds3zzz1")]
|
||||
|
@@ -120,11 +120,19 @@ namespace SqlSugar.MongoDb
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (col.IsJson)
|
||||
{
|
||||
var bsonValue = BsonDocument.Parse(col.Value?.ToString());
|
||||
setDoc[col.DbColumnName] = bsonValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
var bsonValue = UtilMethods.MyCreate(col.Value);
|
||||
setDoc[col.DbColumnName] = bsonValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var update = new BsonDocument
|
||||
{
|
||||
|
Reference in New Issue
Block a user