So I am using this approach on CouchDB docs to perform pagination.
- Request rows_per_page + 1 rows from the view
- Display rows_per_page rows, store + 1 row as next_startkey and next_startkey_docid
- As page information, keep startkey and next_startkey
- Use the next_* values to create the next link, and use the others to create the previous link
One thing I don't understand is, how do I perform sorting using this approach, assuming each document have a last updated timestamp and I want to sort using that field instead of sorting using ids.