[SERVER-3136] A MapReduce with out = {reduce: "coll"} should not have a finalize function since its output type does not match the reduce's input type Created: 24/May/11  Updated: 29/Aug/11  Resolved: 25/May/11

Status: Closed
Project: Core Server
Component/s: MapReduce
Affects Version/s: 1.7.4
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Tony Hannan Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

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".



 Comments   
Comment by Eliot Horowitz (Inactive) [ 25/May/11 ]

There area number of use cases where this is desired.
For example merging data for 2 collections.

Generated at Thu Feb 08 03:02:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.