var o = {};
o.map = function() { emit(this.shopId, this.score); };
o.reduce = function(k, vals) { return { sum: Array.sum(vals), count: vals.length }; };
self.model.mapReduce(o, function(err, items) {
console.log(items);
});
怎么出来的结果跟我预想的不对?
[ { _id: 52b6e1ac3bcdfc6e7fe491d4, value: 3 } ]
预想的不应该是这样的吗:
[ { _id: 52b6e1ac3bcdfc6e7fe491d4, value: { sum: BLAHBLAH, count: BLAHBLAH } } ]