Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning Couchbase

You're reading from  Learning Couchbase

Product type Book
Published in Nov 2015
Publisher
ISBN-13 9781785288593
Pages 248 pages
Edition 1st Edition
Languages
Author (1):
Henry Potsangbam Henry Potsangbam
Profile icon Henry Potsangbam

Table of Contents (12) Chapters

Introduction to Couchbase The Couchbase Administration Interface Storing Documents in Couchbase Using Buckets Designing a Document for Couchbase Introducing Client SDK Retrieving Documents without Keys Using Views Understanding SQL-Like Queries – N1QL Full Text Search Using ElasticSearch Data Replication and Compaction Administration, Tuning, and Monitoring Case Study – An E-Commerce Application Index

Filtering and transforming data


We have written views in the form of map and reduce functions. A view creates indexes and stores them on disk for all documents with the output of map function, along with reduce function's output. Couchbase provides a filtering mechanism for documents generated by views. We can also perform some transformation on data using; the group level, which is discussed subsequently.

Using keys

We can specify key values to filter documents while querying views, like this:

key="2008"

We can also specify a key explicitly to get only that particular key's details. Here, we will get only the view record that pertains to the 2008 key, as follows:

The following screenshot shows the interface to key in the, key to filter indexes:

Key interface

When you execute the view with the preceding key filter, you will only see records that pertain to the particular key, as shown here:

View result

keys=["2007","2008"]

We can explicitly specify a list of keys to get only those particular keys...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}