mochijson2 error from curl mapreduce

John Roy john at
Tue Jun 5 16:22:59 EDT 2012

I saw something similar from an individual who was using javascript (, but I don't think I have the same problem in erlang.  Any help is greatly appreciated.

I'm consistently getting the following error from my curl map reduce calls:


output dictionary here, then:


The term that follows the error appears to the correct result of the map reduce.

I'm just trying the mr locally for testing purposes.  I'm using eleveldb backend and riak (1.1.2 2012-04-17) OSX x86_64.

Here's the curl command:

curl -v -X POST -H "Content_Type: application/json" -d @query.js

and the query.js:

    "inputs" : {
        "bucket" : "test7",
        "index" : "field1_int",
        "start" : 0,
        "end" : 23
    "query" : [
        { "map" : {"language" : "erlang", "module" : "impressions", "function" : "emitStats", "keep" : false} },
        { "reduce" : {"language" : "erlang", "module" : "impressions", "function" : "reduceStats", "keep" : true} }
    "timeout" : 600000

and finally the associated erlang functions:

emitStats(G, undefined, none)->
    ObjectJson = riak_object:get_value(G),
    {struct, DocPropList} = mochijson:decode(ObjectJson),
    I = {proplists:get_value("obj_name",DocPropList,"None"),

reduceStats(Gcounts, none)->
    [lists:foldr(fun(G, Acc)->dict:merge(fun(_, X, Y) -> X+Y end,G, Acc) end,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list