2012-02-09 98 views
1

Grails插件是否支持MapReduce,我該如何使用它?我一直在查看文檔,但沒有看到它。Grails與MongoDb和MapReduce

Gmongo插件支持MapReduce,但我發現文檔有點缺乏。我怎樣才能提供完成功能並將輸出設置爲inline

回答

1

在gmongo中使用這樣的東西來訪問finalize函數ñ。首先定義地圖的串,減少和下面的代碼某處之上完成,然後調用以下代碼:

MapReduceCommand mapReduceCommand = new MapReduceCommand(coll, map, reduce, null, MapReduceCommand.OutputType.INLINE, null) 
    mapReduceCommand.setFinalize(finalize) 
    def result = coll.mapReduce(mapReduceCommand) 

這裏,COLL是collcetion EG的目的:

DBCollection coll = db.<your_collection_name>