basho/basho_docs — pull request #218 by coderoshi (2013-03-29 16:51:11+00:00)
Title: Commit Hook documentation missing key elements

The [commit hook documentation](http://docs.basho.com/riak/1.2.1/references/appendices/concepts/Commit-Hooks/) doesn't seem to have adequate information.

In particular, the [configuration section](http://docs.basho.com/riak/1.2.1/references/appendices/concepts/Commit-Hooks/#Configuration) references how to install named Erlang and JavaScript functions into buckets, but it doesn't say where those functions can come from. I've deduced that `js_source_dir` in `app.config` is where named JavaScript functions should go (and that should be mentioned), but I have no idea where named Erlang functions should go or how they should get there.

In addition, this leaves the question: do I have to upload all JS scripts to all Riak servers? Seems like I do. (It would be nice if there was a REST way to install, via API, new JavaScript functions, or even add anonymous functions right into bucket properties, but that's a different issue.)

Moving forward, there are OK examples of pre and post commit hooks in Erlang and JavaScript, but there's no example Riak object for either.

That is, I'd like a page to be linked to that gives a full example of what a Riak object might look like if you were manipulating it with JavaScript/Erlang in commit hooks. Is it the same structure as when you're using Map/Reduce? I don't think there's even a good example of Riak objects in the docs for M/R, but I could be wrong.

(Example, I want to use a pre-commit hook in JavaScript to add a single 2i field/value to all objects on a bucket. There's nothing in the commit hook docs that show me where, on the Riak object I'm passed, I should be able to add that field/value.)