How do I remove all null
elements in the data array - which is nested in the group array?
{
"_id" : "wLXDvjDvbsxzfxabR",
"group" : [
{
"title" : "title 1",
"data" : [
{
"note" : "text"
},
null
]
},
{
"title" : "title 2",
"data" : [
{
"note 1" : "text"
},
{
"note 2" : "text"
},
null,
{
"note 3" : "text"
},
null
]
}
]
}
So in this example three null
elements should be removed...
This gives me an 409-error:
Collection.update(
{ _id: 'wLXDvjDvbsxzfxabR' },
{ $pull: { "group.$.data": null } }
);