CouchFoo: Like ActiveRecord, but for CouchDB
Apache CouchDB is a "distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API" that has received quite a bit of publicity in developer circles in the past year. It's written in Erlang, so has all of the scalability and flexibility the Erlang environment brings to the table, but as a RESTful service, you can use it from pretty much anywhere.
George Palmer, a UK-based Rails developer, wanted to use CouchDB but found the existing libraries (such as RelaxDB, CouchREST, ActiveCouch and CouchPotato) lacking - not that they are, as such, but they didn't fit George's needs. George wanted something that was as ActiveRecord-like as possible, so he developed CouchFoo (a.k.a. couch_foo) - an ActiveRecord-style interface to CouchDB.
Basic operations (creating records, finding, and even dynamic finders) are much the same as with ActiveRecord, but there have been some additions to deal with the differences in CouchDB (such as defining properties to get typing or view definitions). Associations (has_many, etc) also work as expected.
This is a clever bit of work on George's part and I know that based on the strong feedback he's had, he's decided to submit a RailsConf proposal on CouchFoo. After taking a look at it, I can only hope his talk gets accepted as I'd love to hear more from someone in the know.
As an aside, back in September 2008, PeepCode released a CouchDB with Rails screencast.
February 11, 2009 at 2:29 pm
Worst name ever in the series of foo stuff.
However I'm pleased so many adapters exist for CouchDB and that there's constant striving for perfection among developers.
February 11, 2009 at 3:36 pm
I'd rather see work go into the DataMapper CouchDB adapter, myself.
http://github.com/datamapper/dm-more/tree/63327515cc4430a7a59c717afec5c14c9f299d3d/adapters/dm-couchdb-adapter
February 11, 2009 at 3:47 pm
Just tried couchDB out, it is really cool.
combined with CouchFoo absolutely killing.
I wonder if it plays along nice with rails.
Now let's do a few performance test with CouchFoo in rails.
February 11, 2009 at 4:00 pm
I asked George why he wrote this when there are already so many alternatives, and on the Datamapper front he said there were no docs, it was dependency hell, and views had to be defined manually (as a non-user, I can't elaborate on that).
In any case, I'd much rather someone produce something new than get dissuaded and give up on improving something that already exists.
February 11, 2009 at 4:17 pm
Railsenvy podcast is gonna love this. Finally a plugin that ends in foo again :P
February 11, 2009 at 4:36 pm
Well get ready, I hear it's going to be on there.
February 11, 2009 at 4:56 pm
@tonyc I had quite a lot of problems with the DM adapter myself (no associations, incomplete doc) and critically it doesn't manage views automatically (views are a bit like indexes over a subset of the documents in your database).
@basaah - very interested to hear any results you get there - dm me on twitter @Georgio_1999
@mislav, @sam - What can I say? I guess naming isn't my strong point!! ;)
February 11, 2009 at 5:11 pm
Thanks for following up, George. :) The name doesn't matter anyway, as long as it's pronounceable and not offensive.
February 11, 2009 at 10:38 pm
@george I'm the current maintainer of the DM adapter, and realize it needs work. Time has been at a premium for me, but I am rewriting it to include better view generation. Updated docs should follow, but were there specific things that were unclear? Could you details your dependency issues so we can track them down? Associations should work the same as they do for other DataMapper models, what issues did you have? I'd love to make the adapter better, so any details you could provide would be greatly appreciated.
February 12, 2009 at 1:07 am
Why are there so many couchdb adapters trying to be activerecord? Seems like ar tries to address relational db suckage while couchdb addresses data in a totally different way.