Class: Mongo::Operation::Write::Command::CreateUser

Inherits:
Object
  • Object
show all
Includes:
Specifiable, Writable
Defined in:
lib/mongo/operation/write/command/create_user.rb

Overview

Create user commands on non-legacy servers.

Since:

  • 2.0.0

Constant Summary

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 Limited

#options

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, #session, #to_return, #txn_num, #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 operation response, if there is one.

Since:

  • 2.5.0



38
39
40
41
42
43
44
45
# File 'lib/mongo/operation/write/command/create_user.rb', line 38

def execute(server)
  result = Result.new(server.with_connection do |connection|
    connection.dispatch([ message(server) ], operation_id)
  end)
  server.update_cluster_time(result)
  session.process(result) if session
  result.validate!
end