Ruby开发的面向文档的数据库 RDDB
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')
本文由用户 openkk 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!