I have the following collection with three documents:
{
_id: 1
items: ['1a', '1b', '1c']
},
{
_id: 2,
items: ['2a', '2b', '2c']
},
{
_id: 3,
items: []
}
I have a query that have to move '1a','1c','2a','2b' elements from their corresponding documents into documents with _id: 3.
I need to get the following result:
{
_id: 1
items: ['1b']
},
{
_id: 2,
items: ['2c']
},
{
_id: 3,
items: ['1a','1c', '2a', '2b']
}
Help me please. What is better solution for resolving my problem?