Heim > Fragen und Antworten > Hauptteil
Mapreduce
我在做MR的时候想把结果写入一个新集合中,其实之前也有做过,但是在我印象中好像总是写不进去啊,摔!
//....more code
try {
cmd = new MapReduceCommand(
this.dbc, MapString,
ReduceString,
dbtemp,
MapReduceCommand.OutputType.REPLACE,
query);
cmd.setFinalize(Finalize);
output = this.dbc.mapReduce(cmd);
}
//...more code
MapReduceCommand 的形参如下
public MapReduceCommand(com.mongodb.DBCollection inputCollection, java.lang.String map, java.lang.String reduce, java.lang.String outputCollection, com.mongodb.MapReduceCommand.OutputType type, com.mongodb.DBObject query) { /* compiled code */ }
希望有做过mongo的小伙伴一起讨论讨论