Pagination with Dates and refresh


I’ve read some documentation on pagination for Couchbase. What I would like to do is create a call that grabs the first 100 results based on date, then will grad the next 100 results based on end date of the previous 100. Also equally important is on refresh to get all new entries. So whatever entries are before the first 100 results, up to 100.

Is grouping the only way and/or the most efficient way to sort dates in Couchbase?



Couchbase views are using a key (or compound key) to allow you to query, sort and group (reduce), so you need to emit the date in your view , something like:

emit( dateToArray(doc.yourDate));

So yes it is the proper and best way to do this.

Have you looked at this blog post about pagination:



Thanks I have read that blog post and that was helpful.

One thing we have found is the startkey_docid is not working when making a call like the following:

We have tried without descending. Either way the doc with id 41070cfc-a85c-424c-9b87-fce0616c77c1 is still showing up and the only row skipped is the first row in the results.

Here is a link to the question on stackoverflow,: