Database

[{"_id":1,"comments":[{"postedBy":1,"comment":"Text 1"},{"postedBy":2,"comment":"Text 2"},{"postedBy":3,"comment":"Text 3"},{"postedBy":4,"comment":"Text 4"},{"postedBy":5,"comment":"Text 5"},]}]

Query

db.collection.update({"_id":1,"comments.postedBy":1},{"$set":{"comments.$.comment":"New Text 1"}},{"new":true})

Result