[ 
https://issues.apache.org/jira/browse/COUCHDB-2824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14904674#comment-14904674
 ] 

Nick Vatamaniuc commented on COUCHDB-2824:
------------------------------------------

group=true&group_level=0 is also ambiguous in a way, because 0 turns off 
grouping, unless we restrict group_level to positive integers only.

If we make these parameters incompatible, it can be simpler to explain as: 
"There is a basic way to control grouping -- via the group parameter, or an 
advanced way -- via group_level, but have to pick one".



> group & group_level view parameters override each
> -------------------------------------------------
>
>                 Key: COUCHDB-2824
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-2824
>             Project: CouchDB
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: Database Core, HTTP Interface
>            Reporter: Nick Vatamaniuc
>
> 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:
> {code:javascript}
> {
>    "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" 
>      } 
> }
> {code}
> Then these queries show the problem:
> {code}
> $ 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}
> ]}
> {code}
> 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:
> {code}
> $ http "$DB1/db1/_design/des1/_view/v1?group_level=1&group=true&group_level=1"
> {"rows":[
> {"key":[1],"value":1111},
> {"key":[2],"value":10000}
> ]}
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to