So CouchDB 2.0 has been out for a while now. Since September actually. I haven’t really played around with it because unlike most other platforms it doesn’t seem to be evolving as quickly. But we’ll see!

I had originally chosen CouchDB due to it’s simple to setup multi-master replication system. This means I could easily backup databases both on-line and offline. This made my operational setup fairly easy, although it did require a big shift from my relational database usage background. Overall I’ve appreciated the perspective the CouchDB 1.x series has given me.

Downloading and starting up the image brought me into the standard interface. First step is to resolve the admin party issue. They still provide a link the bottom right hand corner. It froze up and died. Going to the correct URL with Chrome instead of Safari brought up the Fauxton interface I had expected. Under Setup on the navigational menu on the left they have an interesting wizard asking if we want to run the node in clustered mode or single node mode. Although I would like to replicate streams from other machines I don’t want this node configured for using the Erlang OTP distribution due to my limited knowledge of the impact. Interestingly the system refused to bind the loopback address but was fine with binding on 0.0.0.0. The system then offered to replicate another database immediately which I thought was pretty awesome. The replication can be both local and remote.

Overall the Fauxton is definitely an interesting system. I feel like it’s a much needed upgrade over the original interface (?Futon?). The cancel button doesn’t work in all contexts though or doesn’t work in the manner I would expect.

Dropping in an Application

The primary application I’ve been working on recently is my authentication system. This is backed by CouchDB and doesn’t use any fancy features…including views. I’m wondering how well it will function against CouchDB 2.0 so here goes nothing. Hmm, the inital setup requires using a console to interface with the storage system. I apparently have an old one called env.rb which I should delete (bitrotten). The new one booted up and operated as expected. This application at this time doesn’t utilize views or antying of the sort. In the future this will change however the seek times are small enough where it doesn’t care.

The application booted and ran without any problems. Testing out the features it’s worked well. At least in the context of this application I’m happy to say it looks production ready to use CouchDB 2.0.

Exploring Mango

There is a new query language with CouchDB 2.0 called Mango. The link brings up a JSON editor so I’m interested in learning more.

Slight digression, I clicked on the Permission element within a database and it brought up a proper permissions editor for the databse. Much better than the janky method of adding a sepcific design document like in the CouchDB 1.x series.

{
  "selector": {
    "_id": {
      "$gt": null
    }
  }
}

Running the default query for the database produced all documents in the database in ascending order. The Mango language is rather interesting. It looks like all queries may only be executed against indexed elements.