alxndrsn opened a new issue #1204: view queries default to map unless a reduce is defined and then they run reduce URL: https://github.com/apache/couchdb/issues/1204 ## Expected Behavior View queries should _always_ default to responding with a map if no value for the `reduce` parameter is supplied. ## Current Behavior scenario | query | reduce function defined | result ---|---|---|--- 1 | `http://couch-instance/db-name/_design/ddoc_name/_view/view_name` | no | map 2 | `http://couch-instance/db-name/_design/ddoc_name/_view/view_name` | yes | reduce 3 | `http://couch-instance/db-name/_design/ddoc_name/_view/view_name?reduce=false` | no | map 4 | `http://couch-instance/db-name/_design/ddoc_name/_view/view_name?reduce=false` | yes | map 5 | `http://couch-instance/db-name/_design/ddoc_name/_view/view_name?reduce=true` | no | error 6 | `http://couch-instance/db-name/_design/ddoc_name/_view/view_name?reduce=true` | yes | reduce IMO scenario number **2** is surprising and unhelpful. Adding a reduce to an existing ddoc that is used in application code will break all existing calls to a view which _do not_ define `reduce=false`. It's not possible to define a view which has a reduce function but not a map function, so the inverse does not apply. ## Possible Solution Change the default for `reduce` to `false`. This change would affect a lot of existing users, so would need to be well documented and coincide with a major release version. A couple of alternatives to this change might be: 1. Instead of defaulting, reject view queries which do not specify the `reduce` parameter 2. Update the docs at http://docs.couchdb.org/en/2.0.0/api/ddoc/views.html Currently they read: > reduce (_boolean_) ? Use the reduction function. Default is `true` But might be clearer if they read: > reduce (_boolean_) ? Use the reduction function. Default is `true` if a reduce function is defined, or `false` otherwise. ref https://github.com/pouchdb/pouchdb/issues/7127
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services