the only possible way to get the documents, is to make 2 requests. the first fetches X and all Y's (emiting a object with the Y's id and the include_docs method) and the last makes an request to the db/_all_docs endpoint with an keys parameter including all Z-document-ids as an array. You can't do any "joins" in couchdb. there is no database-side document linking logic.
greets, Matthias
