I have requirement where I have to remove and add array elements in the same document at the same time.
I am doing this by the following approach.
var