Skip to content

Commit

Permalink
Fixed 'finalize' function passed to mapReduce through options not bei…
Browse files Browse the repository at this point in the history
…ng converted to string
  • Loading branch information
alexgorbatchev committed May 30, 2011
1 parent e985fb1 commit e9d9bcb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/mongodb/collection.js
Expand Up @@ -852,19 +852,18 @@ Collection.prototype.mapReduce = function mapReduce (map, reduce, options, callb
reduce = reduce.toString();
}

if ('function' === typeof options.finalize) {
options.finalize = options.finalize.toString();
}

var mapCommandHash = {
mapreduce: this.collectionName
, map: map
, reduce: reduce
};

// Add any other options passed in
var keys = Object.keys(options)
, i = keys.length
, name;

while (i--) {
name = keys[i];
for (var name in options) {
mapCommandHash[name] = options[name];
}

Expand Down

0 comments on commit e9d9bcb

Please sign in to comment.