When the "out" parameter of M/R is used to reduce the output into a collection that does not yet exist, a DB assertion error is thrown:
> db.data.mapReduce(m, r, { query:
{ serial: "BL0208109134", name: "interface-count-up" }, finalize: f, out: { reduce: "reduce" }});
Wed Dec 22 10:58:08 uncaught exception: map reduce failed: {
"assertion" : "Not an index cursor",
"assertionCode" : 9011,
"errmsg" : "db assertion failure",
"ok" : 0
}
If you first create the collection by doing "out: 'reduce'", subsequent reduce operations will work as expected.