サンプル ドキュメント:
{
"_id" : ObjectId("51cd7274267d959cb9f95cea"),
"creation_time" : 100,
"delivered" : true,
"id" : 1,
"user_id" : 10
}
マップ機能:
db.system.js.save({
_id: "mapDummy",
value: function(){
emit(this.user_id,this.user_id);
}
});
縮小機能:
db.system.js.save({
_id: "reduceDummy",
value: function(key,values){
return Array.sum(values);
}
});
mapReduce(...) 関数呼び出し:
db.newsdb.mapReduce("mapDummy", "reduceDummy", {out: "notifications_result", query: {delivered:true}});
{
"result" : "notifications_result",
"timeMillis" : 16,
"counts" : {
"input" : 12,
"emit" : 0,
"reduce" : 0,
"output" : 0
},
"ok" : 1,
}
なぜemit:0
ですか?