I have the following document schema:
let document = {
_id: 'a1',
name: 'some_name',
items: [{
_id: 1,
name: 'item1',
},
{
_id: 2,
name: 'item2',
},
{
_id: 3,
name: 'item3',
},
{
_id: 4,
name: 'item4',
},
]
}
and the following update payload is a list of documents
let updates = [{
_id: 1,
name: 'item11',
},
{
_id: 2,
name: 'item22',
},
{
_id: 3,
name: 'item33',
},
{
_id: 4,
name: 'item44',
},
]
I want to update each item in the collection with the item in the update payload that has the same _id
How can I do this?