这是我的 mapreduce 代码:
DBCollection mongoCollection = MongoDAO.getCollection();
String map = "function() {"
+ "for (index in this.positions.positionList) {"
+ "emit(this._id+'|'+this.headline+'|'+"
+ "this.location.name+'|'+this.location.country.code+'|'+this.publicProfileUrl+'|'+"
+ "this.positions.positionList[index].title+'|'+"
+ "this.positions.positionList[index].company.name+'|'+this.positions.positionList[index].company.industry+'|'+"
+ "this.positions.positionList[index].company.type+'|'+this.positions.positionList[index].company.size+'|'+"
+ "this.lastName+'|'+this.firstName+'|'+this.industry+'|'+this.updatedDate+'|' , {count: 1});"
+ "}}";
String reduce = "";
MapReduceCommand mapReduceCommand = new MapReduceCommand(
mongoCollection, map, reduce.toString(), "final_result",
MapReduceCommand.OutputType.REPLACE, null);
MapReduceOutput out = mongoCollection.mapReduce(mapReduceCommand);
目前我正在处理 140,000 条记录。但是在执行 mapreduce 时,记录数减少到 90,000。数据集中没有重复记录。