Database
[{"_id":ObjectId("618e0e1b17687316dcdd6246"),"groupUID":"abc","orderData":{"charges":{"total":18480.0,"subtotal":13980.0},"items":[{"name":"Chocolate cookies","imageURL":"domainURL2.com/cookies"},{"name":"Chocolate muffins","imageURL":"domainURL2.com/muffins"},{"name":"Chocolate cake","imageURL":"domainURL3.com/muffins"}]}}]
Query
db.collection.update({"groupUID":"abc"},[{"$set":{"orderData.items":{$map:{input:"$orderData.items",in:{$mergeObjects:["$$this",{imageURL:{$cond:{if:{$regexMatch:{input:"$$this.imageURL",regex:"^domainURL2.com"}},then:{$concat:["domainURL1.com",{$arrayElemAt:[{$split:["$$this.imageURL","domainURL2.com"]},-1]}]},else:"$$this.imageURL"}}}]}}}}}])