2013-02-11 81 views
0

我運行在JavaMapReduce的結果集跳過並限制

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

這做工精細和返回值這個蒙戈MapReduce的查詢,但我怎麼可以設定「跳過」和「限制」這些結果?

感謝

回答

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); 

如果任何機構都知道要做到這一點,但不保存地圖縮小結果臨時集合,請張貼,

謝謝