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的朋友一起討論討論