You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by gl...@apache.org on 2018/08/14 13:45:57 UTC
[couchdb-nano] branch master updated: FIX update handler example
code fixes #110 (#111)
This is an automated email from the ASF dual-hosted git repository.
glynnbird pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git
The following commit(s) were added to refs/heads/master by this push:
new 9e26d72 FIX update handler example code fixes #110 (#111)
9e26d72 is described below
commit 9e26d7291485af51c74d67bf2e59dfdef1155dca
Author: necipallef <ne...@gmail.com>
AuthorDate: Tue Aug 14 16:45:54 2018 +0300
FIX update handler example code fixes #110 (#111)
---
README.md | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 746374a..4cf5d60 100644
--- a/README.md
+++ b/README.md
@@ -896,8 +896,10 @@ An example update handler follows:
```js
"updates": {
"in-place" : "function(doc, req) {
- var field = req.form.field;
- var value = req.form.value;
+ var request_body = JSON.parse(req.body);
+
+ var field = request_body.field;
+ var value = request_body.value;
var message = 'set ' + field + ' to ' + value;
doc[field] = value;
return [doc, message];