|
The 'out' option for mapreduce command can be given the 'reduce' option, which according to the wiki documentation:
"
{ reduce : 'collectionName' }
- If documents exists for a given key in the result set and in the old collection, then a reduce operation (using the specified reduce function) will be performed on the two values and the result will be written to the output collection. If a finalize function was provided, this will be run after the reduce as well."
The problem is the reduce function has type "[a] -> a" but the finalize function has type "a -> b". If you run the same mapreduce that has a finalize function more than once with out =
{reduce: "coll"}
, the previous result will have a value of type "b" but the next mapreduce will try to reduce it expecting a value of type "a".
|