1const filter = { age: 17 };
2const doc = { $set: { name: "Naomi" } };
3const options = { new: true };
4
5Cat.findOneAndUpdate(filter, doc, options, (err, doc) => {
6 if (err) console.log("Something wrong when updating data!");
7 console.log(doc);
8});
9