1 like
·
80 reads
6 comments
Hello,
I have a little problem with couchdb, it's about pagination with startkey, endkey and limit. I can page to the next pages. But, I cannot understand how to keep the previous key to return. I use nodejs + express. If I could pass on some material with an example I would appreciate it. I've looked for a lot, a lot, but, there is nothing but the algorithm of the documentation itself. If you can help me I would appreciate it very much.
Thank you.
Sure. I might need more context though
Hello,
The problem was creating the page back, but, I got a tip on how to get around. I use VueJs on the frontend and NodeJs + express on the backend. I haven't implemented it yet, but the solution basically consists of storing a list of startkeys in localstorage, so for each page that goes forward I will have the startkey for the link to come back.
Thank you for your attention.
If it's about pagination, why not use limit&skip rather than start & end key? Do you have any special use case why you have to use keys?
Hello,
The documentation says that limit & skip performs poorly with a large amount of data. So I already want to avoid this problem in the future, treating it as efficiently as possible.
My question was how to return to the previous page. And the solution that stores the keys in the frontend will not add complexity to the project.
I appreciate the suggestion, I will do a deeper analysis to see the cost benefit.
Thank you.
I see. Personally in my experience, I've not hit those performance bottlenecks yet (I've used CouchDB to handle a few thousands of documents). And I'd say, it's quite harder fetching by keys.
However, if that's the case, a workaround could be running an _all_docs to get a list of all documents (just rev and id, without the full document), save those in state/localstorage and use that as basis for performing queries using the ids for start & end key.