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.
精彩评论