Distinct only working with delay for field that is indexed

I have a problem in my Mongo 4.2.9 installation with a sharded cluster:

  1. I am creating a document that has a field id in Mongo via a Mongoose bulkwrite and an update statement using an aggregation:
const update = [{
                    $set: {
                        id: prediction.id,
                        status: {$cond: {if: {$not: ["$status"]}, then: "proposed", else: "$status"}}
                    }
                }];

bulkwriteOperations.push({
   updateOne: {
       filter: {id: prediction.id},
       update: update,
       upsert: true
       }
});
  1. The document is successfully created which I verified after doing a find
  2. A distinct(“id”) doesn’t include the newly created id, I have to wait for a bit until it shows up.

If I remove the update via aggregation and change it to the following, everything works as expected:

const update = {
                    $set: {
                        id: prediction.id,
                        status: "test"
                    }
                };

bulkwriteOperations.push({
   updateOne: {
       filter: {id: prediction.id},
       update: update,
       upsert: true
       }
});

Did anybody have this problem before?