-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.6.4
-
Component/s: None
-
None
-
ALL
It appears that MR chokes if passed a null finalize function:
> res = db.items.mapReduce(m, r);
{
"result" : "tmp.mr.mapreduce_1291928405_106",
"timeMillis" : 3,
"counts" :
,
"ok" : 1,
}
> res = db.items.mapReduce(m, r,
);
Thu Dec 9 13:00:14 uncaught exception: map reduce failed: {
"assertion" : "not code",
"assertionCode" : 10062,
"errmsg" : "db assertion failure",
"ok" : 0
}
The log indicates "can't convert type: 10 to code", which I take to mean MongoDB tried to treat the finalize attribute as code without first checking that it's null.
Note that this is not the behavior of the query attribute:
> res = db.items.mapReduce(m, r,
{ query: null });
{
"result" : "tmp.mr.mapreduce_1291928582_108",
"timeMillis" : 33,
"counts" :
,
"ok" : 1,
}
Besides simple consistency (and the lack of a more specific error message), it would be nice for MR to be null-safe in finalize because I have some utility code that handles cases both with and without a finalize attribute, and the easy thing is just to pass null as the finalize attribute in cases without it. (I can give illustrative Python code if needed.)