// JavaScript source code db.runCommand({ mapreduce: "page", map: function Map() { emit( this.title, // how to group { name: this.name } // associated data point (document) ); }, reduce: function Reduce(key, values) { //reduce用来处理group出来是多条数据的地方
/*去重*/ var arr=[1,4,4,7,3,9,0,3,2,1,"你好","你","你好","你 "]; var arr2=[]; for(var i=0;i<arr.length;i++){ if(arr2.indexOf(arr[i])==-1){ arr2.push(arr[i]); } } console.log(arr2); /*排序*/ var arr=[1,4,2,8,3,0,5]; var tem