BulWrite error " The path must exists in document in order to apply array updates"

Trying to avoid the following bulkWrite error: [BulkWriteError{index=0, code=2, message=‘The path ‘comp_feature_status’ must exist in the document in order to apply array updates.’, details={}}] . One of way would be to ignore updates to an array elements if it doesn’t exists, to create empty array, so I could achieve the following in mongo shell adding empty array with bulkWrite:

 "updateOne":
      {
         "filter": {"dg_mid": {$eq: "29ab2386-15ac-bebe-9914-d683ee4db83e"}},
         "update": {$set: { "comp_feature_status": [] }},
         "upsert": false
      }

However with Java , it seems to be impossible to add an empty array to the existing Document. There is code that I tried to use:

new UpdateOneModel<>(theFilter, update, updateOptions)*
 
 where  filter: Filters.eq("dg_mid", "29ab2386-15ac-bebe-9914-d683ee4db83e")                   
 where update :    Bson update = set("comp_feature_status", new BsonArray());
 where updateOptions :  UpdateOptions.upsert("false")

And comp_feature_status array not added with Java code , but it works OK in mongoShell . Using Mongo Community v. 4.2.8 . Is this really possible to do using Java API?

Thx in advance for yours help