I’ve been watching the CouchDB database project since it has started. It’s the pet project of programmer Damien Katz. I was excited to read an update today announcing that it will be accessible via a RESTful JSON API and the query language for CouchDB will be JavaScript. How cool is that?!

CouchDB is not a relational database but rather a distributed document database. Instead of inserting a row of column values into a table, you save a document, with any number of named fields and values (now represented as JSON objects) into the database where it exists in a kind of addressable pool. Documents can be created, retrieved, updated and deleted without having to worry about schema-design as there is none.

If you do require a little structure you can create views. A view is a dynamic structure that acts like a search query, providing a virtual table of documents matching the query. The query, previously expressed in a proprietary language, is now a JavaScript function which is used to determine which documents to include in the view. Because the views are completely virtual you can have as many as you like and you can add or remove them at any time without touching any of your data. Views are indexed and regularly updated to keep tabs with the state of the documents in the database.

CouchDB has some other impressive attributes; it’s fully ACID compliant, has a security model built in, bi-directional incremental replication and conflict resolution.

But what is it good for? Well the documentation is quick to point out this is not a replacement for relational databases but it is well suited to document style applications like blogs, document management, bug tracking, forums and so on. The CouchDB wiki says:

With very little database work, it is possible to build a distributed document management application with granular security and full revision histories.

CouchDB is still only in Alpha, but there are already demos available and client libraries written in PHP, Ruby and others. You can also download the source code under the GPL license.

I think CouchDB will be one to watch!