couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh803316 <>
Subject Document Updates handler using POST instead of PUT
Date Sat, 11 Dec 2010 18:13:00 GMT
I'm following the wiki guide for document updates here:

I created an update handler _design doc called "active_test", which will
update the active_test value in my document and looks like this for PUT:

"updates" : {
            "active_test" : "function(doc, req) {
                             var field         = req.query.field;
                             var value       = req.query.value;
                             var message = { "active_test": value };
                             doc[field]      = value;

If I were to use a PUT request the url would look something like:
<database>/_design/<design_doc>/_update/active_test/<doc_id> +
'?field=active_test&value=' + value

My question is what if I would like to use a POST instead.  (I know PUT is
recommended but just for my own edification)

I see from the wiki that a POST request should look like this:
POST request against the handler function without a document id:

How is the docid sent for a POST?

This information should probably be added to the wiki :)

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message