Argument names and data types for "map" field/function of JSMapReduceSpec


I’m trying to implement the map function for a JSMapReduceSpec, and I am hitting an issue that could be cleared up with some better documentation. Specifically, what should the function signature be and what data types are fed into these arguments by the MapReduce Framework?

Currently the map field’s documentation is not very helpful:

 * JS function code that implements map logic. (required)
map: !clob

What Im trying to understand is how to implement my map function. I have the following:

function map(batch, objs) {
   var timeIdMap = {};'riskScores').each(function(series) {

When I execute this function I get the following error:
wrapped org.mozilla.javascript.JavaScriptException: C3Error: [*]: Type Obj has no field "riskScores"
Which tells me that my objs argument is not the Type I expected it to be (the type defined in the JSMapReduceSpec.targetType).


the map has the same signature as

You should make sure that when calling JS.mapReduce you specify a targetType that has a field ‘riskScores.’

If that is already the case, try

objs.eachRef(function(o) {'riskScores')...


eachRef fixed the problem. Thank you. Any idea why the “objs” are of type Obj instead of the Map Reduce’s targetType?

Ideally there would be a link in the documentation to the documentation.