Ruby开发的面向文档的数据库 RDDB
openkk
13年前
RDDB 是一个 Ruby 开发的面向文档的数据库系统,其灵感来自 CouchDB。它具有以下特性:
* Documents are simply collections of name/value pairs. * Views can be defined with Ruby code, mapping from a document to any other data structure, such as a String, Array or Hash. * A reduce block can be defined to reduce the initial mapped data from a view. * Views can be materialized to improve query performance. * Datastores are pluggable. Current implementations are RAM, partitioned files and Amazon S3. * Viewstores are pluggable. Current implementations are RAM, file system and Amazon S3. * Materialization stores are pluggable. Current implementations are RAM, file system and Amazon S3. * Distributed materialization may work, but it's going to be rewritten.
示例代码:
# First create an database object database = Rddb::Database.new # Put some documents into it database << {:name => 'John', :income => 35000} database << {:name => 'Bob', :income => 40000} database << {:name => 'Jim', :income => 37000} # 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')