O'Reilly logo

Seven Databases in Seven Weeks by Jim R. Wilson, Eric Redmond

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Day 2: Creating and Querying Views

In CouchDB, a view is a window into the documents contained in a database. Views are the principal way that documents are accessed in all but trivial cases—like those individual CRUD operations we saw in Day 1. Today, we’ll discover how to create the functions that make up a view. We’ll also learn how to perform ad hoc queries against views using cURL. Finally, we’ll import music data, which will make the views more salient and demonstrate how to use couchrest, a popular Ruby library for working with CouchDB.

Accessing Documents Through Views

A view consists of mapper and reducer functions that are used to generate an ordered list of key-value pairs. Both keys and values can be any valid JSON. The simplest ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required