added bulk_load macro
This commit is contained in:
parent
d3a7717363
commit
8363aa6298
|
@ -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.
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue