With the right combination of $lookup, $project, and $match, you can join multiple tables on multiple parameters. You can join two collections in Mongo by using lookup which is offered in 3.2 version. In your case, the query would be
db.comments.aggregate({
$lookup:{
from:"users",
localField:"uid",
foreignField:"uid",
as:"users_comments"
}
})
or you can also join with respect to the users, refer the following commands:
db.users.aggregate({
$lookup:{
from:"comments",
localField:"uid",
foreignField:"uid",
as:"users_comments"
}
})