Database

[{location:{open:true,expected:["foo","bar","baz"]}}]

Query

db.collection.aggregate([{$match:{"location.expected":"foo"}},{$set:{"location.expected":{$map:{input:"$location.expected",as:"loc",in:{$cond:[{$eq:["$$loc","foo"]},ObjectId("60783e804136605b0a48bfe8"),"$$loc"]}}}}}])

Result