Class: Mongo::Operation::Commands::Indexes

Inherits:
Object
  • Object
show all
Includes:
ReadPreference, Specifiable
Defined in:
lib/mongo/operation/commands/indexes.rb

Overview

A MongoDB get indexes operation.

Initialize the get indexes operation.

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.

Examples:

Instantiate the operation.

Read::Indexes.new(:db_name => 'test', :coll_name => 'test_coll')

Since:

  • 2.0.0

Constant Summary

Constants included from ReadPreference

ReadPreference::SLAVE_OK

Constants included from Specifiable

Specifiable::BYPASS_DOC_VALIDATION, Specifiable::COLLATION, Specifiable::COLL_NAME, Specifiable::CURSOR_COUNT, Specifiable::CURSOR_ID, Specifiable::CURSOR_IDS, Specifiable::DB_NAME, Specifiable::DELETE, Specifiable::DELETES, Specifiable::DOCUMENTS, Specifiable::INDEX, Specifiable::INDEXES, Specifiable::INDEX_NAME, Specifiable::MAX_TIME_MS, Specifiable::OPERATION_ID, Specifiable::OPTIONS, Specifiable::READ, Specifiable::READ_CONCERN, Specifiable::SELECTOR, Specifiable::TO_RETURN, Specifiable::UPDATE, Specifiable::UPDATES, Specifiable::USER, Specifiable::USER_NAME, Specifiable::WRITE_CONCERN

Instance Attribute Summary

Attributes included from Specifiable

#spec

Instance Method Summary collapse

Methods included from Specifiable

#==, #bypass_document_validation, #coll_name, #collation, #cursor_count, #cursor_id, #cursor_ids, #db_name, #delete, #deletes, #documents, #index, #index_name, #indexes, #initialize, #max_time_ms, #namespace, #operation_id, #options, #ordered?, #read, #read_concern, #to_return, #update, #updates, #user, #user_name, #write_concern

Instance Method Details

#execute(server) ⇒ Result

Execute the operation.

Examples:

Execute the operation.

operation.execute(server)

Parameters:

  • server (Mongo::Server)

    The server to send this operation to.

Returns:

  • (Result)

    The indexes operation response.

Since:

  • 2.0.0



47
48
49
50
51
52
53
# 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