spring-data-mongodb操作Mongodb
2016-08-23
0 0 0
暂无评分
其他
如何获取积分?
private static MongoTemplate mongoTemplate; static { ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml"); mongoTemplate = (MongoTemplate) context.getBean("mongoTemplate"); } public static void main(String[] args) throws Exception{ //initData(); //test1Mapreduce(); //test1Aggregation(); //testMapreduce2(); //testMapReduce3(); testMapreduce4(); } /** * 统计出用户浏览过的页面地址 */ private static void testMapreduce4() { MapReduceOptions options = MapReduceOptions.options(); String outCollName = "urls"; options.outputCollection(outCollName); options.outputTypeReduce(); mongoTemplate.mapReduce(new Query(), "userBrowseHistory", "classpath:historyMap4.js", "classpath:historyReduce4.js", options, DayCount.class); } /** * 统计出一段时间内用户平均每天访问的次数 */ private static void testMapReduce3() { //为什么不能在reduce中求平均数:因为当某些唯一key的数据只有一条时,不能进入reduce,所以这个时候算平均数 //的话
mongodb
操作
相关源码推荐
自制仿生DOS
0
0
暂无评分
操作系统:用信号量来实现读者-写者问题
0
0
暂无评分
操作系统实验:请求页式管理中的置换算法
0
0
暂无评分
操作系统-抽烟者问题
0
0
暂无评分
windows核心编程第5版源码
0
0
暂无评分
暂无评论