summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/www/script/couch_tests.js4
-rw-r--r--src/couchdb/couch_httpd_view.erl10
2 files changed, 12 insertions, 2 deletions
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js
index af4bf5ea..5ff4ad40 100644
--- a/share/www/script/couch_tests.js
+++ b/share/www/script/couch_tests.js
@@ -1172,6 +1172,10 @@ var tests = {
T(e.error == 'query_parse_error');
}
+ // Reduce support when reduce=false
+ resp = db.view('test/summate', {reduce: false, include_docs: true});
+ T(resp.rows.length == 100);
+
// Check emitted _rev controls things
resp = db.allDocs({include_docs: true}, ["0"]);
var before = resp.rows[0].doc;
diff --git a/src/couchdb/couch_httpd_view.erl b/src/couchdb/couch_httpd_view.erl
index d58dfeee..6f6ff706 100644
--- a/src/couchdb/couch_httpd_view.erl
+++ b/src/couchdb/couch_httpd_view.erl
@@ -308,8 +308,14 @@ parse_view_query(Req, Keys, IsReduce) ->
{"include_docs", Value} ->
case IsReduce of
true ->
- Msg = lists:flatten(io_lib:format("Bad URL query key for reduce operation: ~s", [Key])),
- throw({query_parse_error, Msg});
+ #view_query_args{reduce=OptReduce} = Args,
+ case OptReduce of
+ true ->
+ Msg = lists:flatten(io_lib:format("Bad URL query key for reduce operation: ~s", [Key])),
+ throw({query_parse_error, Msg});
+ _ ->
+ ok
+ end;
_ ->
ok
end,