Hi, I have a M/R function, and I get NaN as a value for some of the results. I dont have any experience with JS. Im escaping JS using Java Drivers.
String map = "function(){" + " emit({"
+ "country: this.info.location.country, "
+ "industry: this.info.industry}, {count : 1}); }";
String reduce = "function(key, values){var count = 0.0;"
+ "values.forEach(function(v){ count += v['count'];});"
+ "return count;}";
MapReduceOutput output = collection.mapReduce(map, reduce, null,
new BasicDBObject("lid", "foo"));
An example ti help clear things:
{"_id":{"country":"gb", "industry":"foo"}, "value":NaN}
Thanks a lot.