Mongodb MapReduce示例1个
Mongodb MapReduce示例1个Map:[javascript]map=function(){emit(this.classid,1)}function () {emit(this.classid, 1);}Reduce:[javascript]reduce=function(key,values){var x = 0;values.forEach(function(v){x+=v});return x;}执行:[javascript]result=db.runCommand({mapreduce:"students",map:map,reduce:reduce,out:"students_result"});