Database

[{"_id":1,"comments":[{"id":1,"answer":"fred"},{"id":ObjectId("000000000000000000000002"),"answer":"barney"},{"id":3,"answer":"wilma"},{/** this has the same "id" as above*/"id":ObjectId("000000000000000000000002"),"answer":"bambam"}]}]

Query

db.collection.update({"_id":1,"comments.id":{"$in":[2,ObjectId("000000000000000000000002")]}},{/** update all elements that "match" arrayFilters*/"$set":{"comments.$[cmt].answer":"dino"}},{"arrayFilters":[{"cmt.id":{"$in":[2,ObjectId("000000000000000000000002")]}}]})

Result