0

このmongo MapReduceクエリをJavaで実行しています

MapReduceCommand mrc = new MapReduceCommand(collection, map,reduce, null,MapReduceCommand.OutputType.INLINE,conditions);  
MapReduceOutput out = collection.mapReduce(mrc);  

これは正常に機能し、値を返しますが、これらの結果に対して「スキップ」と「制限」を設定するにはどうすればよいですか?

ありがとう

4

1 に答える 1

0

これを行う方法はありますが、私が望む正確な方法ではありません。最初に、このように出力を新しいコレクションに保存する必要があります

 MapReduceCommand mrc = new MapReduceCommand(collection, map,reduce,"result",MapReduceCommand.OutputType.REPLACE,conditions);  
 MapReduceOutput out = collection.mapReduce(mrc);  

次に、このようにスキップ制限を設定できます

    DBCursor rs = out.getOutputCollection().find() ;
    rs.skip(0).limit(10);  

map reduce の結果を一時的なコレクションに保存せずにこれを行うことを誰かが知っている場合は、投稿してください。

ありがとう

于 2013-02-11T09:30:07.670 に答える