I tried to use this method in mongoose, Model.findByIdAndUpdate()
, but the console shows it as deprecated.
I know that's a disable warning.
My question is, what is the correct method to make this petition?
User.findByIdAndUpdate(data.id,{$set:user},{new: true},(errUpdate, result)=>{
if(errUpdate){
console.log("error",errUpdate);
}
if(data){
console.log("result", result);
}
})