summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/www/script/couch_tests.js4
-rw-r--r--src/couchdb/couch_httpd_view.erl12
2 files changed, 13 insertions, 3 deletions
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js
index 5ff4ad40..a7844bdc 100644
--- a/share/www/script/couch_tests.js
+++ b/share/www/script/couch_tests.js
@@ -1311,6 +1311,10 @@ var tests = {
T(e.error == "query_parse_error");
}
+ // Test that a map & reduce containing func support keys when reduce=false
+ resp = db.view("test/summate", {reduce: false}, keys);
+ T(resp.rows.length == 5);
+
// Check that limiting by startkey_docid and endkey_docid get applied
// as expected.
var curr = db.view("test/multi_emit", {startkey_docid: 21, endkey_docid: 23}, [0, 2]).rows;
diff --git a/src/couchdb/couch_httpd_view.erl b/src/couchdb/couch_httpd_view.erl
index 6f6ff706..c3ac07e3 100644
--- a/src/couchdb/couch_httpd_view.erl
+++ b/src/couchdb/couch_httpd_view.erl
@@ -346,9 +346,15 @@ parse_view_query(Req, Keys, IsReduce) ->
exact ->
QueryArgs;
_ ->
- Msg = lists:flatten(io_lib:format(
- "Multi-key fetches for a reduce view must include group=true", [])),
- throw({query_parse_error, Msg})
+ #view_query_args{reduce=OptReduce} = QueryArgs,
+ case OptReduce of
+ true ->
+ Msg = lists:flatten(io_lib:format(
+ "Multi-key fetches for a reduce view must include group=true", [])),
+ throw({query_parse_error, Msg});
+ _ ->
+ QueryArgs
+ end
end
end
end.