N1ql on two different documents


Have two documents

  1. In one document type is there
    2.Second document applicationname is there.

I want to pull data by joining these two documents.
Both the documents on same bucket.
document a : type
docyment b : applicaitonname

have written something like this that didn’t work.

select a.* from BUCKETNAME a where a.type = ‘xxx’ and a.applicaitonname = ‘xx’

for this query not getting any results.

Can you please suggest on this.


Do you want to individual document?

select a.* from BUCKETNAME a where a.type = ‘xxx’ OR a.applicaitonname = ‘xx’

If you want Join what is Join criteria?



If you want documents containing one or the other then you should do something like

select a.* from BUCKETNAME a where (a.type = ‘xxx’ OR a.type is missing) AND (a.applicaitonname = ‘xx’ OR a.applicationname is missing) , basically you want to include documents where a.type is missing and just applicationname is true or where application name is missing and a.type is true correct? The only issue is that you will also get documents that dont contain EITHER field. Is this the type of thing you are trying to do? Please let me know.