The following mapReduce runs successfully on a smaller collection in the same sharded db or on the same collection but on a non-sharded DB.
--------------------------------------------------------------------------------
> $mapv = function ()
{ emit(this.v, 1); }function () {
emit(this.v, 1);
}
> $reducev = function ($vis_id, $counts) { var $count = 0; $counts.forEach(function ($c) {$count += $c;}); return $count; }
function ($vis_id, $counts) {
var $count = 0;
$counts.forEach(function ($c) {$count += $c;});
return $count;
}
> $resv = db.vis1.mapReduce( $mapv, $reducev, { query :
} );
Fri Jan 8 12:54:08 JS Error: uncaught exception: map reduce failed: final reduce failed: