Note that req.body, in contrast to req.query, is the raw request body and
have to be parsed manually: JSON.parse(req.body)

2015-01-29 20:52 GMT+01:00 Kiril Stankov <[email protected]>:

> Yes, it really does...
> I am using nano.
> Must be problem there.
> Thanks!
>
> К.
>
>
>
>
> 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 29, 2015 at 8:51 PM, Kiril Stankov <[email protected]>
>> 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, returns 'ok', the revision of the doc is
>>> increased by
>>> 2, but the fields are not changed.
>>> The field I want to update is present in the doc.
>>> Any idea what am I doing wrong?
>>>
>>> Thanks in advance.
>>> ------------------------------------------------------------------------
>>> *With best regards,*
>>> Kiril Stankov,
>>>
>>> On 1/29/2015 2:52 PM, Kiril Stankov wrote:
>>>
>>>> Thanks all!
>>>> ------------------------------------------------------------
>>>> ------------
>>>> *With best regards,*
>>>> Kiril Stankov,
>>>> CEO
>>>>
>>>>
>>>>             This Email disclaimer
>>>>             <http://open-net.biz/emailsignature.html> is integral part
>>>>             of this message.
>>>>
>>>> On 1/29/2015 11:57 AM, Alexander Shorin wrote:
>>>>
>>>>> On Thu, Jan 29, 2015 at 12:45 PM, Ingo Radatz <[email protected]
>>>>> >
>>>>> 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).
>>>>>
>>>>> --
>>>>> ,,,^..^,,,
>>>>>
>>>>
>>>>
>>>>
>

Reply via email to