I’m new to mongodb , I want to update nested array element by id with findOneAndUpdate
const Data = {
items : [
{
id: 1,
name : "a",
child : [
{ id : 11, name "aa"},
{ id : 12, name "bb"},
]
},
{
id: 2,
name : "b",
child : [
{ id : 22, name "ba"},
{ id : 23, name "bb"},
]
},
]
}
It’s exactly the same query that is in the exemple in the deep link I shared I think. If you expect something different, then I didn’t understand your question :/.