Daniel Doubrovkine bio photo

Daniel Doubrovkine

aka dB., CTO at artsy.net, fun at playplay.io, NYC

Email Twitter LinkedIn Github
Mongoid.default_session.collections.map do |c|
  s = Mongoid.default_session.command(collstats: c.name)
  [c.name, s["size"] + s["totalIndexSize"] ]
end.sort_by { |n, s| -s }.take(10).each do |n, s|
  puts "#{n}: #{s}"
end; nil

Outputs something like this:

squirrels: 5432044544
monkeys: 949976816
sleuths: 723951712