Cover by David Mark Clements

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Retrieving data from CouchDB with Cradle

CouchDB doesn't use the same query paradigm that MySQL and MongoDB subscribe to. Instead, it uses a pre-created view to retrieve the desired data.

In this example, we'll use Cradle to obtain an array of quotes according to the specified author, outputting our quotes to the console.

Getting ready

As in the previous recipe, Storing data to CouchDB with Cradle, we'll need CouchDB installed on our system, along with cradle. We can also take the quotes.js file from that recipe, placing it in a new directory.

How to do it...

We're working on the quotes.js file from the prior task where we called checkAndSave if our database existed, or we called it from the callback of db.create if it didn't exist. Let's modify

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required