Method: Mongoid::Criteria::Queryable::Optional#max_scan

Defined in:
lib/mongoid/criteria/queryable/optional.rb

#max_scan(value = nil) ⇒ Optional

Adds the option to limit the number of documents scanned in the collection.

Examples:

Add the max scan limit.

optional.max_scan(1000)

Parameters:

  • value (Integer) (defaults to: nil)

    The max number of documents to scan.

Returns:



96
97
98
# File 'lib/mongoid/criteria/queryable/optional.rb', line 96

def max_scan(value = nil)
  option(value) { |options| options.store(:max_scan, value) }
end