Couchbase server join the array objects


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

contacts document

bank document

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.


{“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 AS c WHERE c.userid = 1),
       banks = (SELECT RAW b FROM default ub UNNEST AS b WHERE b.userid = 1);