Module: Mongoid::Contextual::Command

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

Instance Method Summary collapse

Instance Method Details

#commandHash

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

Examples:

Get the command.

command.command

Returns:

  • (Hash)

    The db command.

Since:

  • 3.0.0



14
15
16
# File 'lib/mongoid/contextual/command.rb', line 14

def command
  @command ||= {}
end

#criteriaCriteria

Get the criteria for the command.

Examples:

Get the criteria.

command.criteria

Returns:

Since:

  • 3.0.0



26
27
28
# File 'lib/mongoid/contextual/command.rb', line 26

def criteria
  @criteria
end

#sessionSession

Get the database session.

Examples:

Get the session.

command.session

Returns:

  • (Session)

    The Moped session.

Since:

  • 3.0.0



38
39
40
# File 'lib/mongoid/contextual/command.rb', line 38

def session
  criteria.klass.mongo_session
end