From 46bf4b727f0fae37b017f194983122c50d3f34e5 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Mon, 20 Jul 2009 04:11:36 +0000 Subject: Initial checkin of _changes filters. The prime weak-spot for this approach is that it maintains an OS-process per connected filtered _changes consumer. I'm pretty sure we'll be able to work around this without changing the API, but it'll involve a lot of OS-process bookkeeping. Those enhancements should generally improve show & list performance as well. Punting on them for now, first wanted to get _changes filters implemented so people could give feedback. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@795687 13f79535-47bb-0310-9956-ffa450edef68 --- test/query_server_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/query_server_spec.rb') diff --git a/test/query_server_spec.rb b/test/query_server_spec.rb index ffa2635b..dfc57a5b 100644 --- a/test/query_server_spec.rb +++ b/test/query_server_spec.rb @@ -239,6 +239,15 @@ functions = { return "tail"; }; JS + }, + "filter-basic" => { + "js" => <<-JS + function(doc, req, userCtx) { + if (doc.good) { + return true; + } + } + JS } } @@ -420,6 +429,18 @@ describe "query server normal case" do should == true end end + + describe "changes filter" do + before(:all) do + @fun = functions["filter-basic"][LANGUAGE] + @qs.reset! + @qs.add_fun(@fun).should == true + end + it "should only return true for good docs" do + @qs.run(["filter", [{"key"=>"bam", "good" => true}, {"foo" => "bar"}, {"good" => true}]]). + should == [true, [true, false, true]] + end + end end def should_have_exited qs -- cgit v1.2.3