As my Node.js obsession continues, I’ve been on the hunt for home hobby projects that explore areas which don’t current have an application in my daytime consulting work.

Last week I spent a bunch of time exploring CouchDB.

It © 2014 Toms Baugis, Flickr | CC-BY | via Wylio


What’s to love about CouchDB?

If you haven’t had reason to play with CouchDB before, you should definitely put it on your “experiment” list. There is plenty of amazing packed into this Db , and it doesn’t seem to get the profile of Mongo or Cassandra.

So what have I enjoyed in the first experience of working with Couch? I’m still a noob, but first impressions are..

  • Couch really gets the web. All of its API happens via standard JSON over RESTful endpoint, and so it’s a pleasure to work with from Node. Just need to throw some JSON around and store it? Couch is outstanding. You don’t need any special client, just install a copy of Postman and start tinkering.
  • A great Node.js client lib (if you want it). Whilst you could happily just use request.js to interact with Couch if you want to go bare metal, there’s also a wonderful Node.js client library called nano which wraps the basics without getting in the way.
  • Excellent web admin console. The Futon web admin tool that comes with Couch is a great to quickstart. Need to experiment with map/reduce scripts? It’s got your back. Keen to replicate a remote Couch db? Yup, that’s straight from the Web UI too. Even bundles a full copy of the manuals for offline work! Nicely done.
  • Great manual. Speaking of manuals, the ones that ships with Couch is excellent. Seems to be basically the O’Reilly CouchDB book in manual form. Really good coverage and example.
  • Replication is first class. Couch has a great multi-master setup where you can easily replication things between instances. Perfect for tinkering on your dev box, then pushing changes to the cloud.
  • Versioning is built in. You update documents by providing a new version of the existing document. The replication model is all constructed around reconciling those versions, and it all works very sweetly.
    That sounds like a pretty glowing first impression? True. But there were a few hairy bits that put me off, though..

My Future Living Room from Flickr via Wylio © 2008 Mark Walz, Flickr | CC-BY | via Wylio

What I’d need to grow to love?

Every db selection is about trade-offs. There are a few things that would stand in the way of me taking on Couch in a big way right away:

  • All queries are map/reduce. All of them. This was a bit of a friction point for me. Sometime I just want to craft a “where” style query and throw in a few params. Couch really forces you to think though how you’re going to approach querying - since it’s all done through writing Map/Reduce JavaScript functions (though there are good docs for this, it was a big shift, and not sure it’s one I am that keen to embrace).
  • Third party hosting seems more limited. There’s some good stuff happening at Iris Couch, but I didn’t find a lot of public alternatives that were within reach of a hobby project.

Next steps?

I’ve really loved the Couch experiment, and I’ll definitely use it in the future. For now, I’m going to do an experimental port my code to Mongo and see how the experience compares.