mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Update mongodb
This commit is contained in:
parent
b39ef3f30e
commit
446af2afad
@ -21,6 +21,11 @@ namespace MongoDbTest
|
|||||||
var data2 = db.Queryable<Student>().Where(it => it.Book.Price == 1).ToList();
|
var data2 = db.Queryable<Student>().Where(it => it.Book.Price == 1).ToList();
|
||||||
if (data2.Count != 1) Cases.ThrowUnitError();
|
if (data2.Count != 1) Cases.ThrowUnitError();
|
||||||
if (data2.First().Book.Price != 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")]
|
[SqlSugar.SugarTable("UnitStudentdfsds3zzz1")]
|
||||||
|
@ -121,8 +121,16 @@ namespace SqlSugar.MongoDb
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var bsonValue = UtilMethods.MyCreate(col.Value);
|
if (col.IsJson)
|
||||||
setDoc[col.DbColumnName] = bsonValue;
|
{
|
||||||
|
var bsonValue = BsonDocument.Parse(col.Value?.ToString());
|
||||||
|
setDoc[col.DbColumnName] = bsonValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var bsonValue = UtilMethods.MyCreate(col.Value);
|
||||||
|
setDoc[col.DbColumnName] = bsonValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user