RSS
21 Nov 2007

RDDB: RESTful Ruby Document-Oriented Database

Author: ceefour | Filed under: Cool, JRuby, Rails, Ruby, Tools, Web 2.0

Sometimes it’s nice to use a database with a different paradigm. RDDB might be just what you’re looking for:

RDDB is a Ruby document-oriented database system inspired by CouchDB and developed by Anthony Eden. Querying is accomplished through views using Ruby for the view language and materialization can be handled locally or through a distributed system.

You can create a database and insert documents in a simple enough way:

# First create an database object
database = Rddb::Database.new
# Put some documents into it
database << {:name => 'John', :income => 35000}
database << {:name => 'Bob', :income => 40000}

To “query” the database, you define a “view” using a Ruby block, as such:

# Create a view that will return the names
database.create_view('names') do |document, args|
  document.name

end

# The result of querying will return an array of names

assert_equal ['John','Bob','Jim'], database.query('names')

Just as the local document store, this engine is easy to setup and follows the same semantics for caching, data partitioning, and index accesses.

In all, RDDB is a great example of how much can be accomplished with some thoughtfully laid out Ruby code. The codebase is tiny, and yet the product is amazingly feature rich. Having said that, there is definitely a lot of work to be done before RDDB can become a production-type system.

Read more on:

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.