fixed _update function example

It was only checking for req.id existance (it should
always be included in the request) and not its truthiness.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/couchdb-documentation/commit/af81438e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/tree/af81438e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/diff/af81438e

Branch: refs/heads/import-master
Commit: af81438e1e80dd9b4fda49c6747e1b9754825c88
Parents: d2e77f2
Author: BigBlueHat <[email protected]>
Authored: Wed Mar 26 09:38:57 2014 -0400
Committer: BigBlueHat <[email protected]>
Committed: Wed Mar 26 09:38:57 2014 -0400

----------------------------------------------------------------------
 src/couchapp/ddocs.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-documentation/blob/af81438e/src/couchapp/ddocs.rst
----------------------------------------------------------------------
diff --git a/src/couchapp/ddocs.rst b/src/couchapp/ddocs.rst
index 754b9b7..4f4664a 100644
--- a/src/couchapp/ddocs.rst
+++ b/src/couchapp/ddocs.rst
@@ -419,7 +419,7 @@ The basic example that demonstrates all use-cases of update 
handlers below:
 
     function(doc, req){
         if (!doc){
-            if ('id' in req){
+            if ('id' in req && req['id']){
                 // create new document
                 return [{'_id': req['id']}, 'New World']
             }

Reply via email to