Book Image

Couchbase Essentials

Book Image

Couchbase Essentials

Overview of this book

Table of Contents (15 chapters)
Couchbase Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Joins


N1QL does contain support to perform joins on documents with a caveat—the joins must be made across different buckets. While this is a limitation for several use cases, it does provide a means of putting data together from disparate document sources.

Since this chapter focuses on the beer-sample database, the following join next imagines a setup where beer and brewery documents are stored in two separate buckets named beers and breweries, respectively:

SELECT *
FROM beers AS b
JOIN breweries AS b2
KEYS b.brewery_id