Database

db={"posts":[{id:1,title:"my title",content:"bla bla bla"},{id:2,title:"another title",content:"blah blah blah"}],"likes":[{post_id:1,comment_id:null,user_id:"123",},{post_id:1,comment_id:null,user_id:"456"},{post_id:2,comment_id:null,user_id:"789"}],"comments":[{post_id:1,user_id:"123",content:"great article!!!"},{post_id:1,user_id:"456",content:"bad article!!!"},{post_id:2,user_id:"789",content:"interesting article!!!"}],"users":[{id:"123",name:"Ferb"},{id:"456",name:"Duck"},{id:"789",name:"Rabbit"}]}

Query

db.posts.aggregate([{$lookup:{from:"comments",localField:"id",foreignField:"post_id",as:"comments"}},{$unwind:"$comments"},{$lookup:{from:"users",localField:"comments.user_id",foreignField:"id",as:"comments.user"}},{$set:{"comments.user":{$arrayElemAt:["$comments.user",0]}}},{$group:{_id:"$_id",id:{$first:"$id"},title:{$first:"$title"},content:{$first:"$content"},comments:{$push:"$comments"}}},{$lookup:{from:"likes",localField:"id",foreignField:"post_id",as:"likes"}},{$unwind:"$likes"},{$lookup:{from:"users",localField:"likes.user_id",foreignField:"id",as:"likes.user"}},{$set:{"likes.user":{$arrayElemAt:["$likes.user",0]}}},{$group:{_id:"$_id",id:{$first:"$id"},title:{$first:"$title"},content:{$first:"$content"},comments:{$first:"$comments"},likes:{$push:"$likes"}}}])

Result