I have this dataset and I want find and update by first finding by "_id" then "Questions" by _id using mongoose I tried this but it didn't work
Db.find({_id:id},function(err,data){
data.Questions.find({_id:sub_id},function(err,dt){
res.send(dt)
})
})
this is the dataset
[{
"_id": "443",
"name": "john",
"Questions": [
{
"_id": "21",
"question": "question 1",
"options": [
{
"option": "yes"
},
{
"option": "no"
}
]
},
{
"_id": "65",
"question": "question 2",
"options": [
{
"option": "small"
},
{
"option": "large"
}
]
},
]
}
For example if I want to search by "_id" = 443 and then find Questions where "_id" 65