Dear Wiki user,

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

The "Troubleshooting" page has been changed by SeggyUmboh.
The comment on this change is: Added map/reduce debugging using js command line.
http://wiki.apache.org/couchdb/Troubleshooting?action=diff&rev1=13&rev2=14

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

   system_limit, erlang, open_port:: Erlang has a default limit of 1024 ports, 
where each FD, tcp connection, and linked-in driver uses one port. You seem to 
have exceeded this. You can change it at runtime using the ERL_MAX_PORTS env 
variable.
   (by Adam Kocoloski, 
[[https://bugs.edge.launchpad.net/ubuntu/+source/couchdb/+bug/459241]])
  
+ 
+ == Map/Reduce debugging ==
+ SeaMonkey is a dependency of CouchDB, so you can debug your Map and Reduce 
functions in the js command line. First you assign a document to a variable:
+ {{{
+ js> doc = {
+    "_id": "image-5",
+    "_rev": "3-3e1b61291d9102d84e71e27cb46266fc",
+    "status": 200,
+    "style": "original"
+ }
+ [object Object]
+ }}}
+ Next you assign your function to another variable:
+ {{{
+ js> map = function(doc) { emit(doc.style, doc) }
+ function (doc) {
+     emit(doc.style, doc);
+ }
+ }}}
+ Don't forget to define the emit function as well. I just alias the print 
function:
+ {{{
+ js> emit = print
+ function print() {
+     [native code]
+ }
+ }}}
+ Now you can manually apply your map function to this document, and see what 
gets emitted:
+ {{{
+ js> map(doc)
+ original [object Object]
+ }}}
+ 

Reply via email to