Joining two documents

Hi

I need to join two documents below :

Doc 1
{

"emp" :    {
		"empId" : 123
	   }

}

Doc 2
{

 "address" : {
			"empId" : 456
             }

}

I need the resultant document as below

[
{

"emp" : {
		"empId" : 123
	},	

"address" : {
			"empId" : 456
            }

}
]

I tried the below query

Select b.emp,b.address from Bucketname b
JOIN b.emp e on keys meta(b).id
JOIN b.address a on keys meta(b).id
where e.empId in [123] OR a.empId in [456]

which gives

[
{

"emp" : {
		"empId" : 123
	}

},
{

"address" : {
			"empId" : 456
            }

}
]

but is not what I need. Could somebody please help me out?

To JOIN documents in N1QL, one document must contain or produce the primary key of the other document.

See our docs and https://dzone.com/articles/join-faster-with-couchbase-index-joins