multi-key support for views, temp-views, and alldocs
This commit is contained in:
parent
d7e3c7931f
commit
e2f7163816
3 changed files with 36 additions and 13 deletions
|
@ -22,17 +22,21 @@ describe CouchRest::Database do
|
|||
rs['rows'].select{|r|r['key'] == 'wild' && r['value'] == 'and random'}.length.should == 1
|
||||
end
|
||||
it "should work with a range" do
|
||||
rs = @db.temp_view(@temp_view,{:startkey => "b", :endkey => "z"})
|
||||
rs = @db.temp_view(@temp_view, :startkey => "b", :endkey => "z")
|
||||
rs['rows'].length.should == 2
|
||||
end
|
||||
it "should work with a key" do
|
||||
rs = @db.temp_view(@temp_view,{:key => "wild"})
|
||||
rs = @db.temp_view(@temp_view, :key => "wild")
|
||||
rs['rows'].length.should == 1
|
||||
end
|
||||
it "should work with a count" do
|
||||
rs = @db.temp_view(@temp_view,{:count => 1})
|
||||
rs = @db.temp_view(@temp_view, :count => 1)
|
||||
rs['rows'].length.should == 1
|
||||
end
|
||||
it "should work with multi-keys" do
|
||||
rs = @db.temp_view(@temp_view, :keys => ["another", "wild"])
|
||||
rs['rows'].length.should == 2
|
||||
end
|
||||
end
|
||||
|
||||
describe "map/reduce query with _temp_view in Javascript" do
|
||||
|
@ -98,17 +102,21 @@ describe CouchRest::Database do
|
|||
rs['rows'].select{|r|r['key'] == 'wild' && r['value'] == 'and random'}.length.should == 1
|
||||
end
|
||||
it "should work with a range" do
|
||||
rs = @db.view('first/test',{:startkey => "b", :endkey => "z"})
|
||||
rs = @db.view('first/test', :startkey => "b", :endkey => "z")
|
||||
rs['rows'].length.should == 2
|
||||
end
|
||||
it "should work with a key" do
|
||||
rs = @db.view('first/test',{:key => "wild"})
|
||||
rs = @db.view('first/test', :key => "wild")
|
||||
rs['rows'].length.should == 1
|
||||
end
|
||||
it "should work with a count" do
|
||||
rs = @db.view('first/test',{:count => 1})
|
||||
rs = @db.view('first/test', :count => 1)
|
||||
rs['rows'].length.should == 1
|
||||
end
|
||||
it "should work with multi-keys" do
|
||||
rs = @db.view('first/test', :keys => ["another", "wild"])
|
||||
rs['rows'].length.should == 2
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET (document by id) when the doc exists" do
|
||||
|
@ -426,6 +434,9 @@ describe CouchRest::Database do
|
|||
ds['rows'].length.should == 4
|
||||
ds = @db.documents(:key => 'doc0')
|
||||
ds['rows'].length.should == 1
|
||||
|
||||
rs = @db.documents :keys => ["doc0", "doc7"]
|
||||
rs['rows'].length.should == 2
|
||||
end
|
||||
|
||||
describe "deleting a database" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue