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 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!