Start with a simple CouchDB database.
This document has a flag we will use for a breakpoint.
For example, make a temporary view. Break execution if doc.debug_me is true.
When you click a link, a debugger application opens up. Nothing much happens; but once the code hits a breakpoint, it springs to life. Here is the window upon running the temporary view.
Notice that all the source code is there, intact.
You can step execution, and use the REPL prompt at the bottom. Notice that commands are executed in the context (scope) of the running code.
Here is a design document with a validation function. We will break the code for any document with .debug_me or any document named "some_doc".
Now, create a new document which will trigger the breakpoint.
Immediately upon clicking "Save" in Futon, the debugger comes alive again.
Notice again that the REPL runs on the server, in the standard CouchDB context. Calling a `log()` function from the debugger produces a standard CouchDB log entry.