Proper filtering of array elements in $pull command