Introduction
CouchDB is a highly available, scalable document database. Like MongoDB, it is a NoSQL database; instead of organizing your data in tables related by IDs, you can place documents in the database. Unlike MongoDB, CouchDB has the interesting feature of views.
Documents you place in the DB with specific map and reduce functions that iterate across the data to provide specific views of the data by indexes that you can provide. Views are cached, making it easy to construct high-performance queries that return subsets of data or computed data-like reports.
The primary way you interact with CouchDB is via REST; even the Cradle driver we discuss in this chapter uses REST under the hood for document creation, updation, and deletion. You can also use REST for queries, either through document ID, or by converting an indexed query into a view.
In this chapter, we examine how to integrate CouchDB with Node.js using the Cradle module and how to make REST queries of a CouchDB from the Web.