Saturday, July 11, 2009

CouchDB for Coldfusion

Download the project here: CouchDB for Coldfusion on RIAForge

A recent Twitter by Mingo Hagen inspired me to start my first open-source project on RIAForge: CouchDB for Coldfusion. This project is basically a CFC wrapper for CouchDB operations.

CouchDB is a fairly new concept. It is a document-oriented database that uses a RESTful HTTP/JSON API for interactions. You should read more about it yourself, but here are just a few reasons why it is cool:
* Schema-free storage
* Data is stored as JSON
* All document revisions are saved
* You can interact with the DB directly through the browser via the built-in API
* Built-in web-based admin

CouchDB for Coldfusion is still in the early stages, but already I find it is an easy way to interact with CouchDB. I'll be using this project as a way to learn more about CouchDB. If you'd like to contribute please let me know and I'll give you SVN access.

10 comments:

Mingo Hagen said...

Cool stuff, I'm still very new to CouchDB but am very interested in it for the reasons you state and I've written a couple document-oriented databases inside SQL Server myself.

Edward said...

I was working on a very similar integration earlier this year, but was blocked by the JSON serialization bug with the _rev property.

Filed a bug for CF9, but am very disappointed to see it ignored and CF9 public beta has the same bug.

Its going to be an issue beyond just the "_rev" property, btw.

Russ said...

@Edward

Would you like to work on the project with me? I could use some help!

I was thinking about switching to JSON.cfc for a cleaner fix to that long-numbers bug (assuming JSON.cfc doesn't have the same problem).

Edward said...

I had grabbed JSONUtil by Nathan Mische, which he wrote specifically to work around the typing issues in the Adobe JSON tag.

It's on RIAForge:

http://jsonutil.riaforge.org/

I can shoot you my code - I just need to take a look at it and clean up any obvious issues - haven't looked at it in a couple months.

Russ said...

@Edward

That would be great, especially if you've done any work on with view functions...

Edward said...

I came to the conclusion that it just wasn't worth it to write a view server in CF.

I figured the native JS one would feel pretty "at home" to most CF users.

I also suspected that the JS one would be quite a bit faster...

Russ said...

@Edward

Well I've got the basics of the CF View Server working just fine! It currently accepts view functions in CFscript format.

I admit it was a pain to figure out, but I'm glad I did. The goal of this project is to make CouchDB accessible via CFML, so it would be shameful not to accept view functions written in CFML.

Edward said...

I look forward to seeing your view server!

When do you think you'll commit it to RiaForge?

Russ said...

Within a few days I hope. You can follow my progress via Twitter if you'd like: http://twitter.com/russplaysguitar

Russ said...

@Edward

I added the CF View Server to CouchDB for CF! Its rough, but it works (for linux + CF 8). It is only available thru the SVN because it isn't ready for mass consumption yet.