我使用C#驱动程序在小项目中使用MongoDb,现在我坚持更新文档.试图弄清楚如何更新字段AVG(int)
这是我的代码:
IMongoCollection<Student> studentCollection = db.GetCollection<Student>("studentV1");
Student updatedStudent = new Student() { AVG = 100, FirstName = "Shmulik" });
studentCollection.UpdateOne(
o=>o.FirstName == student.FirstName,
**<What should I write here?>**);
Run Code Online (Sandbox Code Playgroud)
有简单而干净的方法来更新特定字段,如方法ReplaceOne(updatedStudent)?