I am trying for the life of me to understand the proper syntax of subqueries and join in n1ql, plus understanding what is better thing to use for my simple use case, but I can’t find anything like that n the forum or documentation.
There are examples but they are not thoroughly described and it is hard to understand to syntax of a subquery and of JOIN. A general form of subquery and join would be wonderful in documentations…
for my question, I have three doc types on the same bucket, users, vouchers and brands.
each voucher has a “userID” field which holds the id of a user and a brandID which holds an id of a brand.
I want to get a table of users, each with a field “vouchers” (what you call NESTED) in which each line has some voucher data plus some brand data of the brand of that voucher.
so 2 questions:
what is better, subquery or join?
if subquery, do you allow them in SELECT clause? (syntax would be great + an example).
if join, syntax would be great+ an example.