开发者

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

开发者 https://www.devze.com 2023-03-09 19:08 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消