Help -Perform New Updates on a Document Using model.findOneAndUpdate()

Help -Perform New Updates on a Document Using model.findOneAndUpdate()
0

#1

Please help,I can not do this.

Code:

var findAndUpdate = function(personName, doc) {
var ageToSet = 20;

//console.log("person name : ", personName);
Person.findOneAndUpdate(
{“name”: personName},
{$set: {“age”:ageToSet}},
{returnNewDocument : true},
function(err, done){
if(err){
return console.log(“Something wrong when updating record!”);
}
return console.log(done);
})

};