Sha256: 2706976bdd1b0469ad461e0ee50892e49db2859c4d7869d5a2816e70537a5ffb
Contents?: true
Size: 571 Bytes
Versions: 21
Compression:
Stored size: 571 Bytes
Contents
# encoding: utf-8 require 'mongo' module MongodbHelpers def collectioncount(dbcollections) @remote_mongodb = Mongo::MongoClient.new( 'localhost' || $redis.hget('config', 'remotemongo:host'), 27017 || $redis.hget('config', 'remotemongo:port'), ) result = Hash.new dbcollections.keys.each do |db| @db = @remote_mongodb[db] count = Hash.new dbcollections[db].each do |collection| count.merge!(collection => @db[collection].stats['count']) end result.merge!(db => count) end return result end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
gaptool-server-0.3.0 | lib/helpers/mongodb.rb |