I would like to add an item to the middle of an array during the aggregation pipeline.
The solution to the question below shows adding to the end of an array using ‘$concatArrays’, but I would like to add to the middle using something like ‘$position’.
Does anyone know if ‘$push’ will get added as an update operation during the aggregation pipeline?
This blew my mind, I would never have thought of doing that.
I have a recursive data structure that will get big (similar to a file system with folders), so I would prefer to have an option to push into the array. I’m reluctant to reset the entire field as there could be a lot of data to write. Do you know if there is or ever will be a mutable solution like push?
I’ve gone through so much stackoverflow this was really my last shot, so if this is the only option then I’ll stick with it. Thank you so much for the quick reply!