Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
In a view query, if both group and group_level is specified the last one specified overrides any of the previous "group" or "group_level" parameters.
Example:
Create a db (db1), at least one document, a design doc (des1) that looks like:
{ "views": { "v1" : { "map": "function(d){ emit([1,1],1); emit([1,1],10); emit([1,2],100); emit([1,2],1000); emit([2,2],10000); }" , "reduce":"_sum" } }
Then these queries show the problem:
$ http "$DB1/db1/_design/des1/_view/v1?group_level=1&group=true" {"rows":[ {"key":[1,1],"value":11}, {"key":[1,2],"value":1100}, {"key":[2,2],"value":10000} ]}
But users might expect group_level=1 results to show or a 400 request invalid.
Specifying group_level=1 after group=true make group_level=1 take effect:
$ http "$DB1/db1/_design/des1/_view/v1?group_level=1&group=true&group_level=1" {"rows":[ {"key":[1],"value":1111}, {"key":[2],"value":10000} ]}