Java MapReduce结果集跳过和限制
我正在用java运行这个mongo MapReduce查询Java MapReduce结果集跳过和限制,java,mongodb,mapreduce,Java,Mongodb,Mapreduce,我正在用java运行这个mongo MapReduce查询 MapReduceCommand mrc = new MapReduceCommand(collection, map,reduce, null,MapReduceCommand.OutputType.INLINE,conditions); MapReduceOutput out = collection.mapReduce(mrc); 这可以正常工作并返回值,但如何设置这些结果的“跳过”和“限制” 谢谢有一种方法可以做到这一
MapReduceCommand mrc = new MapReduceCommand(collection, map,reduce, null,MapReduceCommand.OutputType.INLINE,conditions);
MapReduceOutput out = collection.mapReduce(mrc);
这可以正常工作并返回值,但如何设置这些结果的“跳过”和“限制”
谢谢有一种方法可以做到这一点,但并不是我想要的方法,首先我必须将输出保存到一个新集合,如下所示
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);
如果有人知道在不保存地图的情况下执行此操作,请将结果还原到临时集合,并将其发布
谢谢