Re: Proxying document updates with update handlers

2021-05-28 Thread Robert Newson
Hi, It’s worth remembering that the reason the new _rev is not available in your _update handler is because the database update happens afterward, and thus the value is not known. Indeed, it is not known if the update even succeeded (or failed because couchdb crashed, or there was a

Re: Proxying document updates with update handlers

2021-05-28 Thread Jan Lehnardt
Hi Aurélien, we generally recommend doing this kind of stuff outside of CouchDB, these days. A Node.js proxy that does this completely and reliably is maybe 50 lines of code and not a huge operational overhead, while granted not as neat as doing all this inside of CouchDB. As for getting the

Re: Proxying document updates with update handlers

2021-05-27 Thread ermouth
Consider using JS _rewrite for this, it can do whatever you want with your request. https://docs.couchdb.org/en/2.3.1/api/ddoc/rewrites.html?highlight=_rewrite#using-a-stringified-function-for-rewrites Please note, that JS _rewrite in v 2.3.1 has a bug which may cause inbound attachments to drop

Proxying document updates with update handlers

2021-05-27 Thread Aurélien Bénel
Dear all, I have known update handlers for quite long but I never used them "for real" myself... My current idea, which must be very common, is to proxy updates of whole documents in order to add some accountability of who contributed to the document and when. # rewrites.json [{