H I cannot work out from just the code you have posted what you are trying to to, can you please just post a minimal example of what you are trying to do, a couple of small example documnts and the query/modification you want to do. We cannot diagnose issues with your code if we don’t know what iut’s trying to do.