updateMany with filter

Hi,

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?

==================
Bson filter = Filters.exists(“xyzfield”, false);

        UpdateResult updateResult =  db.getCollection(collection).updateMany(filter, 
      Updates.set("xyzfield", "specific_value"));
        if(updateResult.wasAcknowledged()){
            logger.info(String.format("Collection :: %s, matched count :: %d,  updated count :: %d",
                    collection,
                    updateResult.getMatchedCount(),
                    updateResult.getModifiedCount()));
        }
        count = StreamSupport.stream(db.getCollection(collection).find(filter).spliterator(), false).count();

logger.info(String.format(" Collection :: %s, Attempt :: %d, left over count :: %d ", collection, attempts, count));

Can you share the output of running your code twice in row?

Can you confirm it is Java code?

Rather than

Can you simply output the first document using db.getCollection(collection).find(filter).first()?

This is java code:
matched count :: 149081, updated count :: 149081
Attempt :: 0, left over count :: 3631
matched count :: 7324, updated count :: 7324
Attempt :: 1, left over count :: 3727

I want to see the first document.

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.

So I do not believe: