Update mongodb

This commit is contained in:
sunkaixuan
2025-05-08 20:02:51 +08:00
parent 13e3305ee5
commit cde25a6417
7 changed files with 127 additions and 14 deletions

View File

@@ -22,13 +22,28 @@ namespace MongoDbTest
.ExecuteReturnPkList<string>();
var updateRow = db.Updateable(new List<OrderInfo>()
var updateRow1 = db.Updateable(new OrderInfo
{
new OrderInfo() { Id = ids.First(),Name="a3",Price=11},
new OrderInfo() { Id = ids.Last(),Name="a4"}
Id = ids.First(),
Name = "a3",
Price = 11
}
)
.ExecuteCommand();
var updateRow2 = db.Updateable(new List<OrderInfo>()
{
new OrderInfo() { Id = ids.First(),Name="a31",Price=11},
new OrderInfo() { Id = ids.Last(),Name="a41"}
})
.ExecuteCommand();
var updateRow3= db.Updateable<OrderInfo>()
.SetColumns(it=>it.Name=="aa")
.Where(it=>it.Id==ids.Last())
.ExecuteCommand();
var delrow = db.Deleteable(new OrderInfo() { Id = ids.Last() })
.ExecuteCommand();