O'Reilly logo

Clojure Programming by Christophe Grand, Brian Carper, Chas Emerick

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

Chapter 15. Using Nonrelational Databases

After years of relational databases being the only functionally available choice for application developers needing to persist data, a number of new classes of databases have come to be regarded as legitimate alternatives to the ubiquitous RDBMS. These databases are each generally very different from each other. Despite their differences, key-value stores and column- and document-oriented databases share a common thread of presenting alternatives to the orthodoxy of the relational data model that has dominated for so long; thus, they are often collectively referred to as nonrelational databases.[372] These data stores’ unique capabilities and increasing popularity make them common components in new Clojure applications, so it’s worth seeing what such a combination looks like.

CouchDB is a document-oriented nonrelational database that defines a data model and architecture that fits well with Clojure’s strengths and world view. The combination is particularly potent, allowing for the relatively simple implementation of many types of applications, from typical web frontends to pleasantly extensible messaging systems.

To start, it would be helpful to describe a couple of CouchDB features that are particularly relevant to Clojure:

  • Its data model consists exclusively of JSON documents, which are trivially converted to and from Clojure’s data structures.

  • It uses an append-only btree-based storage system that defaults to ensuring data durability and ...

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