Database
db={"questions":[{"_id":1,"title":"first"}],"answers":[{"_id":1,"questionId":1},{"_id":2,"questionId":1}],"comments":[{"_id":1,"idQuestion":1,"content":"hello"},{"_id":2,"idAnswer":1,"content":"hi"}]}
Query
db.questions.aggregate([{"$match":{"_id":1}},{"$lookup":{"from":"answers","localField":"_id","foreignField":"questionId","as":"answers"}},{"$lookup":{"from":"comments","let":{"ids":{"answers_id":"$answers._id","question_id":"$_id"}},"pipeline":[{"$match":{"$expr":{$or:[{$eq:["$idQuestion","$$ids.question_id"]},{"$in":["$idAnswer","$$ids.answers_id"]}]}}}],"as":"comments"}},{$project:{"comments":"$comments.content"}}])