class MongoClarify::Investigate

Public Class Methods

new(explain) click to toggle source
# File lib/mongo_clarify/investigate_with_pattern_matching.rb, line 5
def initialize(explain)
  @explain = explain
end

Public Instance Methods

execution_stats() click to toggle source
# File lib/mongo_clarify/investigate_with_pattern_matching.rb, line 20
def execution_stats
  case @explain
  in { executionStats: { nReturned: n, executionTimeMillis: msec, totalKeysExamined: keys, totalDocsExamined: docs } }
  else
    return
  end
  { n_returned: n, execution_time_millis: msec, total_keys_examined: keys, total_docs_examined: docs }
end
operation_method() click to toggle source
# File lib/mongo_clarify/investigate_with_pattern_matching.rb, line 9
def operation_method
  case @explain
  in { queryPlanner: { winningPlan: { stage: 'COLLSCAN' } } }
    'Collection Scan'
  in { queryPlanner: { winningPlan: { stage: 'FETCH', inputStage: { stage: 'IXSCAN', indexName: index_name } } } }
    "Index Scan (Index Name: #{index_name})"
  else
    nil
  end
end