Re: Proxying document updates with update handlers

2021-05-28 Thread Robert Newson
for Apache CouchDB: > https://neighbourhood.ie/couchdb-support/ > > 24/7 Observation for your CouchDB Instances: > https://opservatory.app > >> On 27. May 2021, at 22:08, Aurélien Bénel wrote: >> >> Dear all, >> >> I have known update handlers for quite

Re: Proxying document updates with update handlers

2021-05-27 Thread Jan Lehnardt
not pretty. Best Jan — Professional Support for Apache CouchDB: https://neighbourhood.ie/couchdb-support/ 24/7 Observation for your CouchDB Instances: https://opservatory.app > On 27. May 2021, at 22:08, Aurélien Bénel wrote: > > Dear all, > > I have known update handlers for q

Re: Proxying document updates with update handlers

2021-05-27 Thread ermouth
(https://github.com/apache/couchdb/issues/1878), it was fixed in 3.0 afaik. ermouth чт, 27 мая 2021 г. в 23:09, 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 ve

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. # rew

Re: Document update handlers: Examples

2017-08-14 Thread John Le Brasseur
Thank you for that Stefan. On 10 August 2017 at 14:02, Stefan Klein wrote: > Hi > > 2017-08-10 13:12 GMT+02:00 John Le Brasseur : > > > > Hi. > > I am trying to create a generic document update handler. > > > > I am using: > > > > function(doc, req) {var field = req.query.field; var value = > >

Re: Document update handlers: Examples

2017-08-10 Thread Stefan Klein
Hi 2017-08-10 13:12 GMT+02:00 John Le Brasseur : > > Hi. > I am trying to create a generic document update handler. > > I am using: > > function(doc, req) {var field = req.query.field; var value = > req.query.value; var message = 'set '+field+' to '+value; doc[field] = > value; return [doc, mess

Document update handlers: Examples

2017-08-10 Thread John Le Brasseur
Hi. I am trying to create a generic document update handler. I am using: function(doc, req) {var field = req.query.field; var value = req.query.value; var message = 'set '+field+' to '+value; doc[field] = value; return [doc, message]; } This works ok with simple json but not with a nested obj

Re: Update handlers

2015-02-02 Thread Johannes Jörg Schmidt
; On 1/29/2015 8:08 PM, Alexander Shorin wrote: > >> Works for me for following request: >> >> curl -XPOST 'http://localhost:5984/a/_design/test/_update/test/test? >> field=foo&value=bar' >> -- >> ,,,^..^,,, >> >> >> On Thu, Jan 2

Re: Update handlers

2015-01-29 Thread Kiril Stankov
, 2015 at 8:51 PM, Kiril Stankov wrote: Hi again, I'm still trying to use the Update Handlers, but I'm running into problem: |||function(doc,req) {var field=req.query.field; var value = req.query.value; doc[field]=value; return [doc, 'ok'];} ||| The function executes, return

Re: Update handlers

2015-01-29 Thread Alexander Shorin
Works for me for following request: curl -XPOST 'http://localhost:5984/a/_design/test/_update/test/test?field=foo&value=bar' -- ,,,^..^,,, On Thu, Jan 29, 2015 at 8:51 PM, Kiril Stankov wrote: > Hi again, > > I'm still trying to use the Update Handlers,

Re: Update handlers

2015-01-29 Thread Kiril Stankov
Hi again, I'm still trying to use the Update Handlers, but I'm running into problem: |||function(doc,req) {var field=req.query.field; var value = req.query.value; doc[field]=value; return [doc, 'ok'];} ||| The function executes, returns 'ok', the revision of t

Re: Update handlers

2015-01-29 Thread Kiril Stankov
Thanks all! *With best regards,* Kiril Stankov, CEO This Email disclaimer is integral part of this message. On 1/29/2015 11:57 AM, Alexander Shorin

Re: Update handlers

2015-01-29 Thread Alexander Shorin
On Thu, Jan 29, 2015 at 12:45 PM, Ingo Radatz wrote: > With the help of a rewrite rule you could force an put to be handled by an > update handler before the doc gets stored Need to keep in mind that this rewrite rule could be easily bypassed by bulk update (POST /db/_bulk_docs). -- ,,,^..^,,,

Re: Update handlers

2015-01-29 Thread Ingo Radatz
With the help of a rewrite rule you could force an put to be handled by an update handler before the doc gets stored: { "from": "/:docid", "to": "_update/addTimestamp/:docid", "method": "PUT" } Your root URI must point to the /_rewrite handler of the design doc (a vhost setting can simpl

Re: Update handlers

2015-01-29 Thread Alexander Shorin
Yes, update handlers need to be requested explicitly. No, CouchDB doesn't provides any method to change your documents automagically on PUT. It's not oblivious how this feature should work in case of replication. Normally, you don't need any server side. All you need is to ensure t

Update handlers

2015-01-29 Thread Kiril Stankov
Hi, I'm new to CouchDB and I have a question about updates. It seems that I misunderstood how they work. I assumed that they are automatically called upon submitting or modifying a document to the db. For example, I add a document and I want a field 'createddate' to be automatically filled with

Do update handlers in designdoc support multipart/form-data?

2013-03-21 Thread Anthony Ananich
Hi! I tried to use update handler to upload a file to CouchDB 1.2.1, but I found that update handlers support only application/x-www-form-urlencoded, but does not support support multipart/form-data content type. Is there any other branch or release available which supports multipart/form-data

Re: Using document update handlers?

2010-12-20 Thread Zachary Zolton
nt_Update_Handlers > and I've got couple of questions. > > 1. I'm in need of updating documents without a prior readout to > determine its content and revisions. The task itself is similar to > UPDATE user SET password='x' WHERE user='id'; . I'm wonde

Using document update handlers?

2010-12-20 Thread He Shiming
='x' WHERE user='id'; . I'm wondering if update handlers are designed for this purpose? 2. I've got a update handler like this: function(doc,req){ if (!doc) return [null, 'fail-no-doc']; if (!req.query.id) return [null,'fail-no-id'];

return custom http status from Document Update Handlers

2010-09-03 Thread Zsolt Czinkos
Hello Can I return custom HTTP status from document update handlers? If I return "[null, 'Something bad happened.']", status 200 returned. If I throw an error, then status 500 returned. What if I'd like to return a 4xx status? Thanks for your patience. Zsolt