I had unset an array field, in mongo but it's leave the field with valué null,
the question is, how to remove it!
like this image https://i.sstatic.net/O2WiV.png
I had unset an array field, in mongo but it's leave the field with valué null,
the question is, how to remove it!
like this image https://i.sstatic.net/O2WiV.png
You could remove all null elements from the array with the $pull operation.
See docs
Code example:
db.collecton.update({condition: "x"}, {$pull: {state: null}});
{$pull:{province:null}}. NOTE: This removes ALL null values from the array.