Module: MongoMapper::Plugins::Stats::ClassMethods
- Defined in:
- lib/mongo_mapper/plugins/stats.rb
Instance Method Summary collapse
Instance Method Details
#stats(scale: nil) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/mongo_mapper/plugins/stats.rb', line 8 def stats(scale: nil) query = { :collstats => collection.name } query[:scale] = scale if scale stats = database.command(query).documents[0] Struct.new(*stats.keys.collect { |key| key.underscore.to_sym }).new(*stats.values) rescue nil end |