How to join 2 different documents

Hi,
I have 2 nested documents one is for loans and another one is for user details.i have multiple loans in loans json along with i have userId, and how to fetch details of corresponding users from user json.i have multiple userIds in same loans json.the following are my json documents

Loans Json
{
"_id": “abc322fa-1076-44f4-a5e7-5f29ec36172d”,
“type”: “loans”,
“Loan”: [
{
“loId”: “7b8d56c9-b417-42e8-8dde-6359caeb7269”,
“agentId”: “f6efae77-4066-44c9-b55d-4b9595b32567”,
“userId”: “f6efae77-4066-44c9-b55d-4b9595b32567”,
“loAmount”: “10000”,
“loDownPayment”: “1000”,
“loInstAmt”: “100”,
“loInterest”: “10”,
“loNoofDays”: “103”,
“loPaymentAmt”: 9000
},
{
“loId”: “36cd35bd-c3b6-4c6d-8599-f7e857b7a531”,
“agentId”: “f6efae77-4066-44c9-b55d-4b9595b32567”,
“bizId”: “5fb6617a-fe43-4eac-af56-6295d90df30a”,
“brcId”: “e4e8bbb2-dfff-48f2-b0b9-944047c4fe2d”,
“userId”: “f6efae77-4066-44c9-b55d-4b9595b32567”,
“loAmount”: “10000”,
“loDownPayment”: “1000”,
“loInstAmt”: “100”,
“loInterest”: “10”,
“loPaymentAmt”: 9000,
},
{
“loId”: “b83a7d1a-97dc-4cf0-921d-36fd93cdee04”,
“agentId”: “f6efae77-4066-44c9-b55d-4b9595b32567”,
“bizId”: “5fb6617a-fe43-4eac-af56-6295d90df30a”,
“brcId”: “e4e8bbb2-dfff-48f2-b0b9-944047c4fe2d”,
“userId”: “eeqq7-4066-44c9-b55d-4b9weeeb32568”,
“loAmount”: “10000”,
“loInstAmt”: “100”,
“loInterest”: “11”,
“loNoofWeeks”: 101,
“loPaymentAmt”: 9000,

}

]
}

Users Json

{
"_id": “1665ce10-b739-4a8b-8ff7-161a38b1f534”,
“type”: “users”,
“userProfile”: [
{
“userId”: “f6efae77-4066-44c9-b55d-4b9595b32567”,
“aadharNo”: “445566129065”,
“firstName”: “Jane”,
“lastName”: “George”,
“gender”: “F”,
“panNo”: “1122007749”,
“mStatus”: “S”,
“username”: “jane”
},
{
“userId”: “eeqq7-4066-44c9-b55d-4b9weeeb32568”,
“aadharNo”: “789566129065”,
“firstName”: “Jaise”,
“lastName”: “Mariya”,
“gender”: “F”,
“panNo”: “1907007749”,
“mStatus”: “S”,
“username”: “jaise”
}
]
}

Go though following guide.

https://developer.couchbase.com/documentation/server/4.6/n1ql/n1ql-language-reference/from.html#concept_rnt_zfk_np__lookup-join

SELECT l., u. FROM loans As l JOIN Users u ON KEYS l[*].userId;

In addition to above link by @pankaj.sharma you can take look https://dzone.com/articles/visually-explaining-n1ql-joins