Sha256: 2abb0f8f572e31d5434afadb6ae2130c0ecd772cd2317212ad89dc287215046d
Contents?: true
Size: 880 Bytes
Versions: 1
Compression:
Stored size: 880 Bytes
Contents
module MongoProfiler class Payload attr_reader :payload def initialize(payload) @payload = (payload || {}).dup.with_indifferent_access end def system_database? !payload['database'].to_s.match(/^admin|system/).nil? end def system_collection? !payload['collection'].to_s.match(/^mongo_|system/).nil? end def system_count? !payload['selector'].to_h['count'].to_s.match(/^mongo_|system/).nil? end def system_distinct? !payload['selector'].to_h['distinct'].to_s.match(/^mongo_|system/).nil? end def system_command? payload['collection'] == '$cmd' && !(payload['selector'].to_h.has_key?('count') || payload['selector'].to_h.has_key?('distinct')) end def system_any? system_database? || system_collection? || system_count? || system_distinct? || system_command? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongo_profiler-0.0.1 | lib/mongo_profiler/payload.rb |