Hello People,
I am a rookie in couchbase and N1QL. Recently I’ve encountered a scenario where I should fetch some details from one document based on a field that’s coming from other document within the same bucket. For example , consider that below are my documents,
Document_1
{
doc_type : product
productid : PRE1234
feetype: ABC
}
Document_2
{
Doc_type:fee
Feetype:ABC.
}
I should now fetch productid from document1 where feetype = the feetype from document 2. In SQL, I could write the query like below.
Select productid from ‘bucket’ b where b.doc_type=product and b.feetype= (select feetype from ‘bucket’ a where a.doc_type=fee). I cannot use joins are this is not a primary key. It would be great if you could let me know of any suggestions?
Thanks,
Vinoth