Method: Mongoid::Findable#estimated_count

Defined in:
lib/mongoid/findable.rb

#estimated_countInteger

Returns an estimated count of records in the database.

Examples:

Get the count of matching documents.

Person.estimated_count

Returns:

  • (Integer)

    The number of matching documents.



84
85
86
# File 'lib/mongoid/findable.rb', line 84

def estimated_count
  with_default_scope.estimated_count
end