On Thu, Dec 20, 2012 at 8:52 AM, David Montgomery
<[email protected]> wrote:
> {fitting_exited_abnormally,[{<<"lineno">>,3},{<<"message">>,<<"TypeError:
> reduce of empty array with no initial value">>}
Hi, David. The error is occurring on line three of your reduce
function, where it calls `values.reduce`:
> query.reduce('''
> function(values, arg){
> return [ values.reduce( function(acc, item) {
...
It's complaining about the fact that `values` is an empty array, so
`values.reduce` doesn't know what to do. You will need to either
include an initial value as a second parameter, like:
values.reduce(function(acc, item) { ... },
{}) //initial empty object
Or check to see if `values` is empty before reducing, like the Riak JS
reduce builtins do:
https://github.com/basho/riak_kv/blob/master/priv/mapred_builtins.js#L68
Cheers,
Bryan
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com