当前位置: 动力学知识库 > 问答 > 编程问答 >

Ruby on Rails 3: How to use MapReduce with the MongoDB Ruby driver?

问题描述:

How can I use MapReduce in Ruby on Rails if I'm using the MongoDB Ruby driver?

网友答案:

Define your map and reduce js functions as variables, and then something along these lines:

activities = Connection.new(host,port).db(dbname).collection('activities')
activities.mapreduce(map,reduce,:out=>'analytics')

The 'analytics' collection will hold the result of the mapreduce operation.

分享给朋友:
您可能感兴趣的文章:
随机阅读: