我使用C#driver在小项目中使用MongoDb,现在我坚持更新文档.
这是我的代码:
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?>**);
有一种简单而干净的方法来更新特定字段,比如方法ReplaceOne(updatedStudent)
?