📜  findOneAndUpdate 返回的值 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:31             🧑  作者: Mango

代码示例1
const filter = { age: 17 };
const doc = { $set: { name: "Naomi" } };
const options = { new: true };

Cat.findOneAndUpdate(filter, doc, options, (err, doc) => {
    if (err) console.log("Something wrong when updating data!");
    console.log(doc);
});