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.
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