📜  mongofindoneandupate - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:56.657000             🧑  作者: Mango

代码示例1
try {
db.grades.findOneAndUpdate(
   { "name" : "A.B. Abracus" },
   { $set: { "name" : "A.B. Abracus", "assignment" : 5}, $inc : { "points" : 5 } },
   { sort: { "points" : 1 }, upsert:true, returnNewDocument : true }
);
}
catch (e){
   print(e);
}