I want to join more than two collections in MongoDB using the aggregate $lookup. Is it possible to join? Give me some examples.
Here I have three collections:
users:
{
"_id" : ObjectId("5684f3c454b1fd6926c324fd"),
"email" : "admin@gmail.com",
"userId" : "AD",
"userName" : "admin"
}
userinfo:
{
"_id" : ObjectId("56d82612b63f1c31cf906003"),
"userId" : "AD",
"phone" : "0000000000"
}
userrole:
{
"_id" : ObjectId("56d82612b63f1c31cf906003"),
"userId" : "AD",
"role" : "admin"
}