RDDB is a Ruby document-oriented database system inspired by CouchDB and developed by Anthony Eden. If you’re familiar with CouchDB, the whole system should make sense from the start, but if not, read on. 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’)
Views are defined as Ruby blocks that are then used to select the documents and the attributes in the documents that you wish to retrieve. Read More