Pagination With Views And Complex Keys

Hello there,
We are desperately trying to implement pagination on top of a view we have but with not success.
We have a view which is emitting a complex key of three fields: [ X, Y, Z ]
In our query we retrieve all the document with X = “someting”.
This result set may contain more rows than we want to handle in one go so we tried paginating the view as described in the documentation.
Using the limit + skip combination does work, but as stated in the documentation it is not the most efficient way of doing pagination.
So we are adding the start_doc_id parameters to the query - but it is ignored.
We tried many combination of the query (with only start key, with full complex key …) but nothing seems to work.

Any chance you’ll save our day ?


Per the documentation, the parameter is startkey_docid, not start_doc_id. If you happen to be specifying the wrong parameter, it will be silently ignored.

That was just a typo - we are actually trying both on the Console and via the Java SDK but no luck.

My guess is that you probably have an error in the value of the parameter. Because of JSON encoding, these can sometimes be difficult to get right in the UI. It’s slightly easier in the SDK where you have encoding libraries available to you.

I have done this many times so I know it does work correctly. I’d recommend double checking how you escape things and maybe extracting a small code sample mocking the documents and the view queries to test for yourself. You could certainly point us at that code sample to ask for help if you’ve not found the problem.

1 Like