Module: Mongo::Operation::Write::Command::Writable

Includes:
Limited
Included in:
CreateIndex, CreateUser, Delete, DropIndex, Insert, RemoveUser, Update, UpdateUser
Defined in:
lib/mongo/operation/write/command/writable.rb

Overview

Provides common behavior for write commands. Assigns an operation id when executed.

Since:

  • 2.0.0

Instance Method Summary collapse

Methods included from Limited

#options

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.0.0



37
38
39
40
41
# File 'lib/mongo/operation/write/command/writable.rb', line 37

def execute(server)
  server.with_connection do |connection|
    connection.dispatch([ message(server) ], operation_id)
  end
end