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] Update of "Troubleshooting" by SeggyUmboh
Date Sat, 24 Oct 2009 10:06:02 GMT
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.
http://wiki.apache.org/couchdb/Troubleshooting?action=diff&rev1=16&rev2=17

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

  == Map/Reduce debugging ==
  You can debug your Map and Reduce functions in the js command line. The fact that documents
and function definitions are real javascript code makes it trivial to copy and paste both
into SpiderMonkey.
  
- First you assign a document to a variable (I like to copy from the Source tab in Futon):
+ First you assign a document to a variable. I like to copy from the Source tab of a doc in
Futon:
  {{{
  js> doc = {
     "_id": "image-5",
@@ -82, +82 @@

  }
  [object Object]
  }}}
- Next you assign your function to another variable:
+ Next you assign your function to another variable. Again I like to copy from the Source
tab of a design doc in Futon:
  {{{
  js> map = function(doc) { emit(doc.style, doc) }
  function (doc) {
@@ -101, +101 @@

  js> map(doc)
  original [object Object]
  }}}
+ From here, just keep redefining map and applying it to doc until you are emitting the desired
output.
  

Mime
View raw message