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

Karel Minařík commented on COUCHDB-599:
---------------------------------------

This issue is INVALID:

head.total_rows is available only for views without reduce() function OR when 
`?reduce=false` is specified. (#couchdb> rnewson: We don't know up-front how 
many rows will remain after a reduce.)

The attached test fails because a list function needs to execute both send() 
AND return.

(I think it would be helpful to un-comment the tests for `head.total_rows` in 
test suite (list_views.js), so it's transparent for other who may be hit by 
this.)

Thanks to Robert Newson for helping me to figure and sort this out!

Karel

> `head.total_rows` returns empty in a _list function
> ---------------------------------------------------
>
>                 Key: COUCHDB-599
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-599
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core, Test Suite
>    Affects Versions: 0.10, 0.11
>         Environment: Mac OS X 10.5.8, Mac Book Air, CouchDB 0.10.0 (mac 
> ports) and trunk
>            Reporter: Karel Minařík
>
> In a _list function defined like this:
>   function (head, req) {
>     return 'Total: ' + head.total_rows;
>   }
> the `head.total_rows` is undefined. 
> I have created a test case for the issue in this patch (against Git repo at 
> github.com/apache/couchdb):
> --> 
> http://gist.github.com/255972#file_couchdb_head_total_rows_in_list__fail.diff
> See the map/reduce and list function definition in the gist, also the full db 
> dump is included.
> This fails for me on CouchDB 0.10.0 and 0.11.0b77473d79-git.
> There are tests for `head.total_rows` commented out in the test cases 
> (list_views.js, see 
> http://github.com/apache/couchdb/blob/trunk/share/www/script/test/list_views.js#L65-68
>  and 
> http://github.com/apache/couchdb/blob/trunk/share/www/script/test/list_views.js#L265)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to