Database

db={"Product":[{"_id":"p1","title":"Title 1"},{"_id":"p2","title":"Title 2"}],"User":[{"_id":"u1","firsname":"john","lastname":"cane"},{"_id":"u2","firsname":"smith","lastname":"bond"}],"Comment":[{"_id":1,comment:"first comment","commented_by":"u1","commented_on":"p1"},{"_id":2,comment:"first comment","commented_by":"u2","commented_on":"p2"}]}

Query

db.Product.aggregate([{$match:{_id:"p1"}},{$limit:1},{$lookup:{from:"Comment",let:{id:"$_id"},pipeline:[{$match:{$expr:{$eq:["$commented_on","$$id"]}}},],as:"comments"}},{$addFields:{comments:"$comments",comments_no:{$size:"$comments"},hasCommented:{$in:[1,"$comments.commented_by"]},/** req.user._id is the user's id**/}},{$unwind:"$comments"},{$lookup:{from:"User",let:{id:"$comments.commented_by"},pipeline:[{$match:{$expr:{$eq:["$_id","$$id"]}}},],as:"comments.commented_by"}},{$addFields:{"comments.commented_by":{$ifNull:[{$arrayElemAt:["$comments.commented_by",0]},{}]}}},{$group:{_id:"$_id",title:{$first:"$title"},hasCommented:{$first:"$hasCommented"},comments:{$push:"$comments"}}}])

Result