Merge branch 'master' of git://github.com/jchris/couchrest

* 'master' of git://github.com/jchris/couchrest:
  added bulk_load macro
  version support note
This commit is contained in:
Matt Aimonetti 2009-05-13 12:59:42 -07:00
commit 1b6ed9ce93
3 changed files with 12 additions and 0 deletions

View file

@ -8,6 +8,8 @@ to CouchDB's API endpoints so you don't have to.
CouchRest is designed to make a simple base for application and framework-specific object oriented APIs. CouchRest is Object-Mapper agnostic, the parsed JSON it returns from CouchDB shows up as subclasses of Ruby's Hash. Naked JSON, just as it was mean to be. CouchRest is designed to make a simple base for application and framework-specific object oriented APIs. CouchRest is Object-Mapper agnostic, the parsed JSON it returns from CouchDB shows up as subclasses of Ruby's Hash. Naked JSON, just as it was mean to be.
Note: CouchRest only support CouchDB 0.9.0 or newer.
## Easy Install ## Easy Install
Easy Install is moving to RubyForge, heads up for the gem. Easy Install is moving to RubyForge, heads up for the gem.

View file

@ -44,6 +44,11 @@ module CouchRest
end end
end end
# load a set of documents by passing an array of ids
def get_bulk(ids)
documents(:keys => ids, :include_docs => true)
end
# POST a temporary view function to CouchDB for querying. This is not # POST a temporary view function to CouchDB for querying. This is not
# recommended, as you don't get any performance benefit from CouchDB's # recommended, as you don't get any performance benefit from CouchDB's
# materialized views. Can be quite slow on large databases. # materialized views. Can be quite slow on large databases.

View file

@ -599,6 +599,11 @@ describe CouchRest::Database do
ds = @db.documents(:startkey => 'doc0', :endkey => 'doc3', :include_docs => true) ds = @db.documents(:startkey => 'doc0', :endkey => 'doc3', :include_docs => true)
ds['rows'][0]['doc']['another'].should == "doc" ds['rows'][0]['doc']['another'].should == "doc"
end end
it "should have the bulk_load macro" do
rs = @db.bulk_load ["doc0", "doc7"]
rs['rows'].length.should == 2
ds['rows'][0]['doc']['another'].should == "doc"
end
end end