I have the following doc stored in MongoDB:
{
name: 'myDoc',
list: [
{
id:1
items:[
{id:1, name:'item1'},
{id:2, name:'item2'}
]
},
{
id:2
items:[
{id:1, name:'item1'},
{id:3, name:'item3'}
]
}
]
}
I found a way to add an element to 'list' using $addToSet but I couldn't find a way to add to a specific list of 'items' an item.
e.g. I get the following:
{id:5, name:'item5'}
and I want to add it to the element's item in the list with id:2.