On Sat, Dec 24, 2011 at 6:56 PM, Dave Cottlehuber <[email protected]> wrote: > You may find it easier to start a js interpreter up and work through > the validation function directly, using the process outlined in > http://wiki.apache.org/couchdb/Troubleshooting#Map.2BAC8-Reduce_debugging
Thanks for the link, Dave. That technique is nice because of course couchjs ships with CouchDB. However I have found Node.js to be invaluable for testing and debugging my Couch code. I put my main code in a CommonJS module. From there I can import it and exercise it from a Node test framework like node unit[1] or node-tap[2]. I can use the identical module in a CouchDB design document. That is how I maintain Stew, a reduce function which accumulates and counts all map objects: https://github.com/iriscouch/stew [1]: https://github.com/caolan/nodeunit [2]: https://github.com/isaacs/node-tap > obviously you'll need to get a sample userCtx as well. I would think > you can use the same logging function as the view server "log(stuff);" > to do this. Note this is not for use on production DBs due to heavy > perf impact. > > Pro-tip: don't forget to accept all _deleted docs through your > function to ensure MVCC continues to work as expected. > > A+ > Dave -- Iris Couch
