couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Trivial Update of "CommonJS_Modules" by DaveCottlehuber
Date Fri, 30 Jul 2010 15:38:23 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "CommonJS_Modules" page has been changed by DaveCottlehuber.
The comment on this change is: clarify why CommonJS modules can't be used in views.
http://wiki.apache.org/couchdb/CommonJS_Modules?action=diff&rev1=3&rev2=4

--------------------------------------------------

  ## page was renamed from commonjs_modules
  = CommonJS Modules =
+ As of the 0.11 release of CouchDB you can use CommonJS 1.0 modules in your show, list, update,
and validation functions. map and reduce functions '''can NOT''' use modules. This is because
view results are stored in the B-tree, and if the module (which is now external to the view
itself) was updated, CouchDB would not be aware of the changed module, & therefore would
not recompute the view.
- 
- As of the 0.11 release of CouchDB you can use CommonJS 1.0 modules in your show, list, update,
and validation functions. map and reduce functions '''can NOT''' use modules.
  
  {{{#!highlight JavaScript
    {
-    _id:"_design/test", 
+    _id:"_design/test",
     language: "javascript",
     whatever : {
       stringzone : "exports.string = 'plankton';",
@@ -22, +21 @@

     }
    }
  }}}
- 
  Within a show function you can require CommonJS modules that are defined within object in
your design document. The id you pass to require() is a / delimited list of property names
to resolve the module string within the design document.
  
  All imports are relative to the design document root unless they start with ./ or ../, these
are referred to as "relative require" statements. Relative require statements only work within
CommonJS modules they cannot be used directly inside your show, list, update and validation
functions.

Mime
View raw message