couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "antirobotrobot (JIRA)" <j...@apache.org>
Subject [jira] Commented: (COUCHDB-82) total_rows should be the number of rows returned if the count parameter is not supplied
Date Wed, 25 Jun 2008 14:32:45 GMT

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

antirobotrobot commented on COUCHDB-82:
---------------------------------------

Why this is necessary: without it the majority of pagination use cases will require two requests.
One map request to get the rows, and a second map-reduce request to calculate the total rows.

Imagine a livejournal-like application with blog posts owned by different users. We want a
paginated view of a single user's posts. Certainly one view could be made which does
   emit( [doc.user_id, doc.post_date], doc );
And we can query all of the posts of John using startkey=["john"] endkey=["john", []]. Happily
CouchDB tries to solve pagination for us, so we attached count=10 to the view query to get
the first 10 posts of john. However, the total_rows parameter returned by the request tells
us how many posts there are in total, not how many John has. This can be solved with a second
 request. Or alternatively it could be solved by having a view for each user on livejournal.



> total_rows should be the number of rows returned if the count parameter is not supplied
> ---------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-82
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-82
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>            Reporter: antirobotrobot
>
> I need the ability to paginate though a subset of a view. I make view requests with startkey,
endkey, and count. I would like to paginate through these rows, but I cannot know the total
rows between startkey and endkey without making an extra view which adds up the totals.
> It would be much better if total_rows, returned in the view, reflected the number of
rows that would be returned had the count parameter not been supplied.

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


Mime
View raw message