Using MongoDB
MongoDB is another popular document-oriented database. Unlike CouchDB, it favors consistency and partition tolerance as its primary goals. If you’re not concerned with having global locks, then MongoDB is a fine choice.
Connecting to the Database
We’ll use the Monger library for accessing MongoDB. Monger provides an idiomatic Clojure API for working with the database. It provides comprehensive support for the features MongoDB 2.2+ offers. As is the case with Clutch, we can use native Clojure data structures without having to worry about translating them into the MongoDB/BSON format. Finally, Monger defaults to a configuration that emphasizes safety and consistency. The latest version at the time of writing is [com.novemberain/monger ...
Get Web Development with Clojure, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.