class Mongo::Operation::Commands::Indexes
A MongoDB get indexes operation.
Initialize the get indexes operation.
@example Instantiate the operation.
Indexes.new(:db_name => 'test', :coll_name => 'test_coll')
Initialization:
param [ Hash ] spec The specifications for the insert. option spec :db_name [ String ] The name of the database. option spec :coll_name [ String ] The name of the collection.
@since 2.0.0
Public Instance Methods
execute(server)
click to toggle source
Execute the operation.
@example Execute the operation.
operation.execute(server)
@param [ Mongo::Server
] server The server to send this operation to.
@return [ Result
] The indexes operation response.
@since 2.0.0
# File lib/mongo/operation/commands/indexes.rb, line 47 def execute(server) if server.features.list_indexes_enabled? ListIndexes.new(spec).execute(server) else execute_message(server) end end
Private Instance Methods
execute_message(server)
click to toggle source
# File lib/mongo/operation/commands/indexes.rb, line 57 def execute_message(server) server.with_connection do |connection| Result.new(connection.dispatch([ message(server) ])) end end
query_coll()
click to toggle source
# File lib/mongo/operation/commands/indexes.rb, line 67 def query_coll Index::COLLECTION end
selector()
click to toggle source
# File lib/mongo/operation/commands/indexes.rb, line 63 def selector { ns: namespace } end