I've got a MongoDB nested array and am constantly adding and removing to the nested arrays inside. Sometimes this will leave lots of empty arrays just sitting around in their respective document. For example, take the image below. Lets say I remove index 0 and 1 from the play array. Considering it's now empty, I want play to be removed entirely from disabled_channels as soon as I complete .updateOne().
Is there a way to have MongoDB automatically remove an array field from a document after updating and the array is empty? I know you can do this with middleware but I've only ever seen this with Javascript, not Java :(
