i am running updateMany with filter where a field doesnt exist and set that field to a value. And the number of records are around 33M. Once the updateMany is done, I expect new runs will not have any matching documents.
(During this update, incoming traffic is disabled)
But on multiple runs, we find new matching documents. What could be the issue with this code?
However, it is clear from the output you supplied that you have something that creates new documents while you are testing.
After the first run you get
but when you run your second attempt you have
It means that 7324 - 3631 new documents have been created between the 2 runs and that 3631 new documents have been created while the first attempt was running. What ever is running has created 3727 new documents during the 2nd attempt.