Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env ruby
require 'mongo-hadoop'
MongoHadoop.reduce do |key, values|
count = sum = 0
values.each do |value|
count += 1
sum += value['num']
{ :_id => key, :average => sum / count }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment