I have objects like in my collection:
{
"foo": {
"actions": [
...,
"delete"
]
},
"bar": {
"tags": ["links", ...]
}
}
I want to remove delete value from foo.actions from all objects that contain links value in bar.tags field.
I tried to do a basic update that seems not to work:
db.foo.update({
"bar.tags": /links/
}, {
$pull: {
"foo.actions": "delete"
}
}, {
multi: true
});
delete field is not removed since the following request doesn't return 0:
> db.foo.find({"bar.tags": /links/, "foo.actions": /delete/}).count()
786
What's the issue here? Why delete value is not removed?
tagsis inside of another object. Maybe that makes the difference?