Database

[{_id:ObjectId("62aafb10e9123be010871280"),task_id:ObjectId("62aad470a743c5d36362fc2f"),comments:[{user_id:ObjectId("627e4b14c35e9de228efe63b"),comment:"Tested this feature in Staging and it's working as expected",_id:ObjectId("62aafb10a743c5d3636303c5"),created_at:ISODate("2022-06-16T09:42:40.619Z")}]},{_id:ObjectId("62aafbafe9123be0108712ed"),task_id:ObjectId("62aafb5da743c5d3636303d8"),comments:[{user_id:ObjectId("627e4b14c35e9de228efe63b"),comment:"Tested this feature in staging and it's working as expected",_id:ObjectId("62aafbafa743c5d363630413"),created_at:ISODate("2022-06-16T09:45:19.732Z")}]},]

Query

db.collection.update({},[{"$addFields":{"comments":{"$map":{input:"$comments",as:"c",in:{"$mergeObjects":["$$c",{"comment":{"markup":"$$c.comment","text":"$$c.comment"}}]}}}}}],{multi:true})

Result