I'm trying to remove an attribute from a triple-nested array without success. Here is an example of the data I want to remove:
Controls: [
{
Name: 'ControlNumberOne',
Submit: {
Executes: [
{
Name: 'execute',
Type: 0
},
{
Name: 'anotherExecute',
Type: 0
}
]
}
},
{
Name: 'ControlNumberTwo',
Submit: {
Executes: [
{
Name: 'anotherFromAnotherControl',
Type: 1
}
]
}
}
]
I tried the following update queries but none of them worked:
db.Page.update('Controls.Submit.Executes.Type': { $exists : true } }, { $unset : { 'Controls.Submit.Executes.Type' : 1 } }, false, true);)db.Page.update('Controls.Submit.Executes.Type': { $exists : true } }, { $unset : { 'Controls.$.Submit.Executes.$.Type' : 1 } }, false, true);)
However, if I execute db.Page.find('Controls.Submit.Executes.Type': { $exists : true } }) it does return all the Executes that still have a Type attribute.
Can this be achieved? Thanks!
Executesseems to be an object, not an array.