[SERVER-4847] Wrong key returned from map/reduce Created: 02/Feb/12 Updated: 29/Feb/12 Resolved: 02/Feb/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 2.0.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Trivial - P5 |
| Reporter: | Jeff lee | 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 |
|
It looks like there's an optimization for map reduce jobs that can result in the wrong key name being returned if there is only a single tuple to process. Notice how the keys for groups 1 and 5 are returned as "thetot" instead of "tot" in the job below. I believe this is caused by line 103/124 of db/commands/mr.cpp. The workaround appears easy enough but I thought I'd report it. Thanks > db.goo.save( {group:1, amt:5}); ); ); ); ); ); ); ); ); ); ); ); } ); ; ) ; ); }); }, }, }, }, } , |
| Comments |
| Comment by Jeff lee [ 02/Feb/12 ] |
|
Heh...I guess it helps to fully read the docs. Thanks! |
| Comment by Eliot Horowitz (Inactive) [ 02/Feb/12 ] |
|
This is correct behavior. What you emit and what reduce returns has to be the same format as things get re-reduced. So its possible things won't get reduced at all if there is only 1 entry for a key. You can use finalize to do final processing per key. |