I have 2 subproperties of a document and want to move all properties from one to another, but AFTERWARDS I want to erase the empty property.
Now I know the $rename command can be used to move each property from one place to another, but I also want the empty object destroyed, but only after the move.
So how does one do this?
Here is an example:
{
_id : ObjectID,
firstProperty : {
value0 : 1,
value1 : 2
},
secondProp: {
value5 : 3,
value6 : 4
}
}
Then after process:
{
_id : ObjectID,
firstProperty : {
value0 : 1,
value1 : 2,
value5 : 3,
value6 : 4
}
}