Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.
The "Formatting_with_Show_and_List" page has been changed by yaMatt. The comment on this change is: req.docId is always undefined. req.id actually contains the value.. http://wiki.apache.org/couchdb/Formatting_with_Show_and_List?action=diff&rev1=23&rev2=24 -------------------------------------------------- } } }}} - If the show function is queried with document id that has no corresponding document in the database, `doc` is `null` and the submitted document shows up in `req.docId`. This is useful for creating new documents with a name, like in a wiki. + If the show function is queried with document id that has no corresponding document in the database, `doc` is `null` and the submitted document shows up in `req.id`. This is useful for creating new documents with a name, like in a wiki. - If the show function is queried without a document id at all, doc is `null` and `req.docId` is `null`. This is useful for creating new documents where the user specifies the new document id in a user interface, like in a CMS. + If the show function is queried without a document id at all, doc is `null` and `req.id` is `null`. This is useful for creating new documents where the user specifies the new document id in a user interface, like in a CMS. {{{#!highlight javascript function(doc, req) { if(doc) { // regular doc display logic } else { // document not found - if(req.docId) { + if(req.id) { // handle unused doc id } else { // handle unspecified doc id