Module: Mongoid::Contextual::Command

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



9
10
11
# File 'build/mongoid-7.4/lib/mongoid/contextual/command.rb', line 9

def collection
  @collection
end

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



9
# File 'build/mongoid-7.4/lib/mongoid/contextual/command.rb', line 9

attr_reader :collection, :criteria

#criteriaObject (readonly)

Returns the value of attribute criteria.



9
10
11
# File 'build/mongoid-7.4/lib/mongoid/contextual/command.rb', line 9

def criteria
  @criteria
end

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



9
# File 'build/mongoid-7.4/lib/mongoid/contextual/command.rb', line 9

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.



27
28
29
# File 'build/mongoid-7.4/lib/mongoid/contextual/command.rb', line 27

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.



17
18
19
# File 'build/mongoid-7.4/lib/mongoid/contextual/command.rb', line 17

def command
  @command ||= {}
end