我试图在 Mongo shell 中做一个简单的 map reduce,但 reduce 函数永远不会被调用。这是我的代码:
db.sellers.mapReduce(
function(){ emit( this._id, 'Map') } ,
function(k,vs){ return 'Reduce' },
{ out: { inline: 1}})
结果是
{
"results" : [
{
"_id" : ObjectId("4da0bdb56bd728c276911e1a"),
"value" : "Map"
},
{
"_id" : ObjectId("4da0df9a6bd728c276911e1b"),
"value" : "Map"
}
],
"timeMillis" : 0,
"counts" : {
"input" : 2,
"emit" : 2,
"output" : 2
},
"ok" : 1,
}
怎么了?
我在 Ubuntu 10.10 上使用 MongoDB 1.8.1 32 位