N1QL Joins on same bucket but with different type of document

Thank you for your question. We are working to improve the documentation around JOINS. The Join syntax works as follows:

Say you have two documents. One of them needs to contain a field whose value contains the Couchbase KV key of the other document:

“keyA” is the Couchbase KV key for Doc A.

Doc A: {
some fields
}

Doc B: {
some fields
“joinField”: “keyA"
}

SELECT * FROM default b JOIN default a ON KEYS b.joinField

NOTE: In your example documents, if you’re trying to retrieve a specific list of assignments it might be helpful to UNNEST the assignments array prior to your application consuming the results.

Thanks

Todd