CouchDB lives up to its tag line: relax. Instead of focusing on working well only in massive clusters running on hundreds of nodes, CouchDB aims to support a variety of deployment scenarios from the datacenter down to the smartphone. You can run CouchDB on your Android phone, on your MacBook, and in your datacenter. Written in Erlang, CouchDB is built tough—the only way to shut it down is to kill the process! With its append-only storage model, your data is virtually incorruptible and easy to replicate, back up, and restore.
CouchDB is document oriented, using JSON as its storage and communication language. All calls to CouchDB happen through its REST interface. Replication can be one way (from one database to another) or bidirectional (back and forth between databases), and ad hoc (triggered at will) or continuous (triggered at periodic intervals). CouchDB gives you a lot of flexibility to decide how to structure, protect, and distribute your data.
One of the big questions we wanted to address in this book is “What’s the difference between CouchDB and MongoDB?” On the surface, CouchDB and MongoDB—which we covered in Chapter 4, MongoDB—can seem quite similar. They’re both document-oriented databases with an affinity for JavaScript that use JSON for data transport. There are many differences, though, ranging from project philosophy to implementation to scalability characteristics. We’ll cover many of these as we explore the beautiful simplicity of CouchDB.
During our three-day tour, we’ll explore many of CouchDB’s compelling features and design choices. We’ll start, as always, with individual CRUD commands and then move on to indexing through mapreduce views. As we’ve done with other databases, we’ll import some structured data and then use it to explore some advanced concepts. Finally, we’ll develop some simple event-driven client-side applications using Node.js and learn how CouchDB’s master-master replication strategy deals with conflicting updates. Let’s get to it!