json:{
data:{
id:"123"}
,
res:{
message:false,
"resId":"afdsfd"
}
}
I have to update res in upper json but unable to do so using mongoose in NodeJS, my present approach is
model.findOneAndUpdate({"data.id":Id},{res:{message:true,"resId":"eeee"});
am I doing something wrong please help me out?
You should do it like this:
.findOneAndUpdate({"data.id":Id},{
"res.message": true,
"res.resId": "eeee"
})