I have a show function that returns a form, given a document id. The form posts to an update handler function:
<form action="../../_update/my-update-handler/CURRENT_DOC-ID" method="post">
The update handler returns the following:
"code": 303, // patched CouchDB to not use hardcoded HTTP codes
"headers": {
"Location": "/my-db/_design/my-design/_show/my-show-funct/NEXT-DOC-ID"
},
"body": "redirecting"
I’d like to iterate through all the documents in the database. I realize this is what list functions are for, but I don’t see how to yeld to the client between each form submission.
How do I fetch NEXT-DOC-ID everytime the update handler is called?
You won’t be able to do this from within the
_showfunction or the_updatehandler.However, if you establish a view with the list of document IDs, you can query that list when your form has loaded, determine the next document ID, and pass that along with the other parts of the form to the
_updatehandler. (via a hidden input field)