christkv/node-mongodb-native — Issue #426: Collection.prototype.group doesn't support finalize function
Author: tpisto
Created: 2011-12-04 20:42:46+00:00
State: open

For group it's also important to give finalize like here (http://blog.boxedice.com/2010/06/21/map-reduce-and-mongodb/)

db.sd_boxedice_checksLoadAvrg.group(
{
initial: {count: 0, running_average: 0},
reduce: function(doc, out)
{
out.count++;
out.running_average+=doc.v;
},
finalize: function(out)
{
out.average = out.running_average / out.count;
}
}
);

Currently the group function at node-mongodb-native doesn't support finalize, but only

keys
conditions
initial
reduce

Please support also finalize function.