http://docs.couchdb.org/en/latest/couchapp/views/pagination.html#paging-alternate-method -- ,,,^..^,,,
On Tue, May 19, 2015 at 8:09 PM, Kiril Stankov <[email protected]> wrote: > Hi, > > I am trying to implement pagination, but I run into an issue. > My view is pretty simple, it emits documents with a composite key - one of > the doc's fields and a date field: > emit([doc.refID, new Date(doc.date*1000)], null); > The query I send is: > http://db:port/db/_design/designDoc/_view/ByRefID?startkey=["somekey",{}]&endkey=["somekey"]&descending=true&skip=0&limit=4 > > This works fine. The problem is that from the response: > > {"total_rows":20,"offset":14,"rows":[ > {"id":"205765617df5163269f3a6c02d03d4ab","key":["409aea325150f27b69fee977fa03580a","2015-05-19T16:26:36.000Z"],"value":null}, > {"id":"205765617df5163269f3a6c02d01d0ac","key":["409aea325150f27b69fee977fa03580a","2015-05-14T12:32:01.000Z"],"value":null}, > {"id":"409aea325150f27b69fee977fa10d9bd","key":["409aea325150f27b69fee977fa03580a","2015-04-23T12:16:59.000Z"],"value":null}, > {"id":"409aea325150f27b69fee977fa0fc301","key":["409aea325150f27b69fee977fa03580a","2015-04-23T11:10:20.000Z"],"value":null} > ]} > > I cannot tell if there are more items to show. > > The total_rows returns the number of all documents matching the view, not > only those matching the start and end keys. Also, I do not know how to > interpret the offset param in this case. What 14 stands for, in this case. > > Any idea will be appreciated. > Thanks in advance! > ------------------------------------------------------------------------ > *With best regards,* > Kiril Stankov, >
