1// Pass {new: true} if you want the updated result in the doc variable:
2Cat.findOneAndUpdate({age: 17}, {$set:{name:"Naomi"}}, {new: true}, (err, doc) => {
3 if (err) {
4 console.log("Something wrong when updating data!");
5 }
6
7 console.log(doc);
8});