Re: Pass json as argument to mapreduce

2012-07-06 Thread Mathias Meyer
Venki, >From what I gather you're trying to specify arguments directly as objects in >the function's argument list? You reference the arg that's passed into the >MapReduce request by declaring a third parameter variable, not by specifying >an object: function(value, keydata, arg) {doSomethingWi

Re: Pass json as argument to mapreduce

2012-07-05 Thread Venki Yedidha
Thanks again, I changed args to arg. To keep it simple, I just want to use that arg parameter value {"gender":"G0,G1"," agegroups":"A0,A2","metrics":"users,cpc_median","groupby":"country"} inside my javascript function. If I try to assign it to a variable like: var k = arg; It is givin

Re: Pass json as argument to mapreduce

2012-07-05 Thread Mathias Meyer
Venki, The parameter name is arg not args. Also, you were talking about some sort of error you're getting, but I couldn't see one in the listing below. Cheers, Mathias http://riakhandbook.com On Thursday, 5. July 2012 at 16:29, Venki Yedidha wrote: > Thanks, > I tried the format you sent m

Re: Pass json as argument to mapreduce

2012-07-05 Thread Venki Yedidha
Thanks, I tried the format you sent me earlier but when I tried to access the args parameter inside the function, it is showing me the error: {"inputs":['.$k.'],"query":[{"map":{"language":"javascript","source":"function(value,keydata,"arguments"){ var data = Riak.mapValuesJson(value)[0];

Re: Pass json as argument to mapreduce

2012-07-04 Thread Mathias Meyer
Venki, You don't have to serialize the argument as a JSON string, it can simply be specified as a normal JSON data structure, just like the other data in the MapReduce request: curl -v -d '{"inputs":[["artists", "Beatles"]], "query":[{"map":{"language":"javascript","source":"function(v, k, a)