How to set unique object ids in embedded documents across a MongoDB collection

MongoDB’s updateMany can be used to update all documents which are matched. ProblemIf, however, you want to set unique new ObjectIDs in your update, you would find that MongoDB sets the same ObjectID for every entry:db.getCollection('mypis_collectedpis').updateMany({}, {$set:      {apps: {         "com.picockpit/core": {             meta: {                 version: "2.0",                 name: "PiCockpit Core",                 image: "",                 description: " core application"                 [...]