Module: Mongoid::Collections

Extended by:
ActiveSupport::Concern
Included in:
Components
Defined in:
lib/mongoid/collections.rb,
lib/mongoid/collections/retry.rb,
lib/mongoid/collections/master.rb,
lib/mongoid/collections/operations.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods, Operations, Retry Classes: Master

Instance Method Summary collapse

Instance Method Details

#collectionCollection

Note:

Defining methods instead of delegate to avoid calls to Kernel.caller for class load performance reasons.

Get the collection for the class.

Examples:

Get the collection.

person.collection

Returns:

Since:

  • 1.0.0



25
26
27
# File 'lib/mongoid/collections.rb', line 25

def collection
  self.class.collection
end

#dbDB

Note:

Defining methods instead of delegate to avoid calls to Kernel.caller for class load performance reasons.

Get the database for the class.

Examples:

Get the database.

person.db

Returns:

  • (DB)

    The class db.

Since:

  • 1.0.0



40
41
42
# File 'lib/mongoid/collections.rb', line 40

def db
  self.class.db
end