Can I update all the subdocuments in array matching my update query? Here is example of collection elements:
{
x: 1,
myarray: [
{
a: 1,
b: 2,
},
{
a: 1,
b: 4,
}
]
}
Then I write query like this:
MyModel.update({x: 1, myarray.a: 1},
{$set:
{"myarray.$.b": 3}
},
function(err) {
});
It updates only the first subdocument in myarray. In the documentation it is written that this kind of queries update only the first document. I want to know if there is a way to update all matching subdocuments in array. Thanks in advance.