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

Querying with beer-sample


So far, we've explored a wide variety of view queries. For some more concrete examples, we'll turn now to the beer-sample bucket. If you followed along in Chapter 3, Creating Secondary Indexes with Views, you should already have a design document created in this bucket. If so, then feel free to reuse that document. If not, then you'll need to create a new document.

Start by returning to the Views tab on the Couchbase Web Console. Select the beer-sample bucket to retrieve the current set (if any) of views within the dev_beers design document. If you did not follow along in the previous chapter, refer to the Creating a view section in Chapter 3, Creating Secondary Indexes with Views to get started. The following screenshot shows the Couchbase Console's Views tab:

The Couchbase Console Views tab

Querying all documents by type

We'll start by revisiting the first view we looked at in this chapter — querying for all documents of a given type. Our first approach was to create...