Does this help? http://guide.couchdb.org/draft/recipes.html#pagination
On Thu, Jul 18, 2013 at 9:05 AM, Paul Roebuck <[email protected]>wrote: > Have a couchapp whose list() can't seem to output its information > before OS timeout occurs. We initially just increased the OS timeout, > but still have issues depending on whatever else is going on. > > What is the recommended means of paginating the output with > multiple calls (i.e., pieces parts instead of the whole enchilada)? > > list(head, req) { > provides("json") { > // generate time consuming output > } > provides("xml") { > // generate time consuming output > } > } > > Had initially thought of adding a response header and doing a HEAD > call, but had problems kept getting badarg exceptions (does using > provides() preclude using start()?). > > list(head, req) { > start({ > headers: { > "X-NRows": head.total_rows > } > }); > > provides("json") { > if (req.method === 'HEAD') > return ""; > > // generate time consuming output > } > provides("xml") { > // generate time consuming output > } > } > > Assuming I can retrieve this value, then the idea was to make a series > of GETs to same list function with its view using 'limit=' and 'start=', > collating the output using mbostock's QueueJS on HTML page prior > to display. > > Or is there a better way? > > Thx. >
