diff --git a/lib/mongo/collection.rb b/lib/mongo/collection.rb index f6c4698..9d2c54c 100644 --- a/lib/mongo/collection.rb +++ b/lib/mongo/collection.rb @@ -171,10 +171,11 @@ function () { key[keys[i]] = obj[keys[i]]; } - var aggObj = map[key]; + var aggObj = map.get(key); if (aggObj == null) { var newObj = Object.extend({}, key); - aggObj = map[key] = Object.extend(newObj, initial); + aggObj = Object.extend(newObj, initial); + map.put(key, aggObj); } reduce_function(obj, aggObj); }