An example of the null handling issue is below. If I test (and fix)
for null in the map, this m/r query runs fine.
Thanks.
rtb@mon-raw> map = function () {
... emit(this.geo.country,{count:1});
... }
function () {
emit(this.geo.country, {count:1});
}
rtb@mon-raw> reduce = function (key, values) {
... var result = {count:0};
... values.forEach(function(doc) {
... result.count += doc.count;
... });
... return result;
... }
function (key, values) {
var result = {count:0};
values.forEach(function (doc) {result.count += doc.count;});
return result;
}
rtb@mon-raw> db.request.mapReduce(map,
... reduce,
... {query:{"created.simple":
{$gte:"20120207192900",$lt:"20120207193000"}},
... out:"test_coll"})
{
"result" : "test_coll",
"timeMillis" : 12494,
"counts" : {
"input" : 4229,
"emit" : 4229,
"reduce" : 133,
"output" : 62
},
"ok" : 1,
}
rtb@mon-raw> db.request.mapReduce(map,
... reduce,
... {query:{"created.simple":
{$gte:"20120207192900",$lt:"20120207193000"}},
... out:{inline:1}})
Thu Feb 16 16:43:46 uncaught exception: map reduce failed:{
"assertion" : "assertion db/commands/mr.cpp:400",
"errmsg" : "db assertion failure",
"ok" : 0
}
rtb@mon-raw>