Subscribe Favorite

RDDB: RESTful Ruby Document-Oriented Database

Written on November 21, 2007 by Eka Riyanti

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:

If you enjoyed this post Subscribe to our feed

One Comment on “RDDB: RESTful Ruby Document-Oriented Database”

  1. Morning Brew #89 |

    […] RDDB: RESTful Ruby Document-Oriented Database […]

Leave a Reply