Method: Mongoid::Contextual::Mongo#length

Defined in:
lib/mongoid/contextual/mongo.rb

#lengthInteger Also known as: size

Returns the number of documents in the database matching the query selector.

Examples:

Get the length.

context.length

Returns:

  • (Integer)

    The number of documents.



289
290
291
# File 'lib/mongoid/contextual/mongo.rb', line 289

def length
  self.count
end