Couchbase server join the array objects

Hi

i’m new for the couchbase server and i have doubt on how to join and join the documents more than two documents and join the array objects like

users document
{
“id”:“user123”,
user:[
{‘userid’:1,“name”:“arun”},…{“userid”:n,“name”:“name”}
]
}

contacts document
{
“id”:“contact_123”,
“contact”:[
{“userid”:1,“address”:“address”},…
]
}

bank document
{
“id”:“bank_123”,
“bank”:[
{“userid”:1,“bankname”:“bank1”}…
]
}

i wanna to get result from those three documents by userid=1.
help me solve this.

Could you post desired output you are looking.
What happens when different users document has some userid =1, same for the other documents. What is desired output

thanks for the quick reply

based on my requirement i need to save all users in one document.

like
users

{“doc_id”:123,“users”:[
{“user1 obj”},{“user2 obj”}…
]
}

like bank and contact also

from those array objects i need to fetch a particular users data only.

like 100’s of user data need stored in single doc,like bank and contacts also.

from this i need to retrieve particular user data by using a user_id.

the user_id will be unique.

SELECT users, contacts, banks
LET users = (SELECT RAW u FROM default ud UNNEST ud.users AS u WHERE u.userid = 1),
       contacts = (SELECT RAW c FROM default uc UNNEST uc.contact AS c WHERE c.userid = 1),
       banks = (SELECT RAW b FROM default ub UNNEST ub.bank AS b WHERE b.userid = 1);