summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_httpd_view.erl
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-03-20 10:58:52 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-03-20 10:58:52 +0000
commit0b55e8a26c9314312732f6481ae62c7a5611f072 (patch)
treec4173d9ce900ce4c67ec3b822e17064a1be15a73 /src/couchdb/couch_httpd_view.erl
parentc87b89dea947ac11ce46f9f7d6dcf873caa990d4 (diff)
map queries with group=true query option will return an error.
closes COUCHDB-185. changes to jquery.couch.js to support ajaxOptions may be useful for more than just openDoc, will need to be spread to the rest of the API. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@756413 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_view.erl')
-rw-r--r--src/couchdb/couch_httpd_view.erl9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/couchdb/couch_httpd_view.erl b/src/couchdb/couch_httpd_view.erl
index 4e922d50..f5f0f5f4 100644
--- a/src/couchdb/couch_httpd_view.erl
+++ b/src/couchdb/couch_httpd_view.erl
@@ -97,6 +97,7 @@ output_map_view(Req, View, Group, Db, QueryArgs, nil) ->
start_key = StartKey,
start_docid = StartDocId
} = QueryArgs,
+ validate_map_query(QueryArgs),
CurrentEtag = view_group_etag(Group),
couch_httpd:etag_respond(Req, CurrentEtag, fun() ->
{ok, RowCount} = couch_view:get_row_count(View),
@@ -114,6 +115,7 @@ output_map_view(Req, View, Group, Db, QueryArgs, Keys) ->
skip = SkipCount,
start_docid = StartDocId
} = QueryArgs,
+ validate_map_query(QueryArgs),
CurrentEtag = view_group_etag(Group, Keys),
couch_httpd:etag_respond(Req, CurrentEtag, fun() ->
{ok, RowCount} = couch_view:get_row_count(View),
@@ -134,6 +136,13 @@ output_map_view(Req, View, Group, Db, QueryArgs, Keys) ->
finish_view_fold(Req, RowCount, FoldResult)
end).
+validate_map_query(QueryArgs) ->
+ case QueryArgs#view_query_args.group_level of
+ 0 -> ok;
+ _ ->
+ throw({query_parse_error, <<"Query parameter \"group\" and/or \"group_level\" are invalid for map views.">>})
+ end.
+
output_reduce_view(Req, View, Group, QueryArgs, nil) ->
#view_query_args{
start_key = StartKey,