Module: Mongoid::Contextual::Command

Included in:
FindAndModify, GeoNear, MapReduce, TextSearch
Defined in:
lib/mongoid/contextual/command.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) collection (readonly)

Returns the value of attribute collection



8
9
10
# File 'lib/mongoid/contextual/command.rb', line 8

def collection
  @collection
end

- (Object) collection The collection to query against.(Thecollectiontoqueryagainst.) (readonly)



8
# File 'lib/mongoid/contextual/command.rb', line 8

attr_reader :collection, :criteria

- (Object) criteria (readonly)

Returns the value of attribute criteria



8
9
10
# File 'lib/mongoid/contextual/command.rb', line 8

def criteria
  @criteria
end

- (Object) criteria The criteria for the context.(Thecriteria) (readonly)



8
# File 'lib/mongoid/contextual/command.rb', line 8

attr_reader :collection, :criteria

Instance Method Details

- (Hash) command

The database command that is being built to send to the db.

Examples:

Get the command.

command.command

Since:

  • 3.0.0



18
19
20
# File 'lib/mongoid/contextual/command.rb', line 18

def command
  @command ||= {}
end

- (Session) session

Get the database session.

Examples:

Get the session.

command.session

Since:

  • 3.0.0



30
31
32
# File 'lib/mongoid/contextual/command.rb', line 30

def session
  collection.database.session
end