Module: Mongoid::Contextual::Command

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

Overview

Mixin module included in objects which represent database commands.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



12
13
14
# File 'lib/mongoid/contextual/command.rb', line 12

def collection
  @collection
end

#collection The collection to query against.(Thecollectiontoqueryagainst.) ⇒ Object (readonly)



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

attr_reader :collection, :criteria

#criteriaObject (readonly)

Returns the value of attribute criteria.



12
13
14
# File 'lib/mongoid/contextual/command.rb', line 12

def criteria
  @criteria
end

#criteria The criteria for the context.(Thecriteria) ⇒ Object (readonly)



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

attr_reader :collection, :criteria

Instance Method Details

#clientMongo::Client

Get the database client.

Examples:

Get the client.

command.client

Returns:

  • (Mongo::Client)

    The Mongo client.



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

def client
  collection.database.client
end

#commandHash

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

Examples:

Get the command.

command.command

Returns:

  • (Hash)

    The db command.



20
21
22
# File 'lib/mongoid/contextual/command.rb', line 20

def command
  @command ||= {}
end