module Mongo::Collection::View::Explainable

Defines explain related behavior for collection view.

@since 2.0.0

Constants

ALL_PLANS_EXECUTION

The all plans execution verbosity constant.

@since 2.2.0

EXECUTION_STATS

The execution stats verbosity constant.

@since 2.2.0

QUERY_PLANNER

The query planner verbosity constant.

@since 2.2.0

Public Instance Methods

explain() click to toggle source

Get the explain plan for the query.

@example Get the explain plan for the query.

view.explain

@return [ Hash ] A single document with the explain plan.

@since 2.0.0

# File lib/mongo/collection/view/explainable.rb, line 47
def explain
  self.class.new(collection, selector, options.merge(explain_options)).first
end

Private Instance Methods

explain_options() click to toggle source
# File lib/mongo/collection/view/explainable.rb, line 57
def explain_options
  explain_limit = limit || 0
  { :limit => -explain_limit.abs, :explain => true }
end
explained?() click to toggle source
# File lib/mongo/collection/view/explainable.rb, line 53
def explained?
  !!options[:explain]
end