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.4.13 lib/helpers/mongodb.rb
gaptool-server-0.4.12 lib/helpers/mongodb.rb
gaptool-server-0.4.11 lib/helpers/mongodb.rb
gaptool-server-0.4.10 lib/helpers/mongodb.rb
gaptool-server-0.4.9 lib/helpers/mongodb.rb
gaptool-server-0.4.8 lib/helpers/mongodb.rb
gaptool-server-0.4.7 lib/helpers/mongodb.rb
gaptool-server-0.4.6 lib/helpers/mongodb.rb
gaptool-server-0.4.5 lib/helpers/mongodb.rb
gaptool-server-0.4.4 lib/helpers/mongodb.rb
gaptool-server-0.4.3 lib/helpers/mongodb.rb
gaptool-server-0.4.2 lib/helpers/mongodb.rb
gaptool-server-0.4.1 lib/helpers/mongodb.rb
gaptool-server-0.4.0 lib/helpers/mongodb.rb
gaptool-server-0.3.8 lib/helpers/mongodb.rb
gaptool-server-0.3.7 lib/helpers/mongodb.rb
gaptool-server-0.3.6 lib/helpers/mongodb.rb
gaptool-server-0.3.3 lib/helpers/mongodb.rb
gaptool-server-0.3.2 lib/helpers/mongodb.rb
gaptool-server-0.3.1 lib/helpers/mongodb.rb