Sto tentando di rimuovere un attributo da un array a triplo nidificazione senza successo. Ecco un esempio dei dati Voglio rimuovere:MongoDb: come annullare l'attributo dagli array annidati?
Controls: [
{
Name: 'ControlNumberOne',
Submit: {
Executes: [
{
Name: 'execute',
Type: 0
},
{
Name: 'anotherExecute',
Type: 0
}
]
}
},
{
Name: 'ControlNumberTwo',
Submit: {
Executes: [
{
Name: 'anotherFromAnotherControl',
Type: 1
}
]
}
}
]
ho provato la seguente query di aggiornamento, ma nessuno di loro ha lavorato:
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);)
Tuttavia, se eseguo db.Page.find('Controls.Submit.Executes.Type': { $exists : true } })
i t restituisce tutti gli Executes che hanno ancora un attributo Type.
Questo obiettivo può essere raggiunto? Grazie!
vostro 'Executes' sembra essere un oggetto, non un array. – madhead
hai ragione, l'ho messo in pericolo ... per favore dai un'occhiata ora! – faloi