Попробуйте это
db.items.mapReduce(
function () {
emit(this.name, this.price);
},
function (key, value) {
Array.sum(value)
},
{ out: "map_reduce_example" }
)
ИЛИ
var first = function () {
emit(this.name, this.price);
}
var second = function (key, value) {
Array.sum(value)
}
db.items.mapReduce(
first,
second,
{ out: "map_reduce_example" }
)