Database

db={posts:[{"id":"1","comments":[{_id:"c1",userId:"u1",text:"Hi there, who are you?"},{_id:"c2",userId:"u1",text:"Hi! Are you still there?"},]}],users:[{"_id":"u1","name":"James","username":"jamo"}]}

Query

db.posts.aggregate([{$lookup:{from:"users",localField:"comments.userId",foreignField:"_id",as:"users"}},{$project:{comments:{$map:{input:"$comments",as:"c",in:{$mergeObjects:["$$c",{$arrayElemAt:[{$filter:{input:"$users",cond:{$eq:["$$c.userId","$$this._id"]}}},0]}]}}}}}])

Result