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(context) ⇒ Result

Execute the operation. The context gets a connection on which the operation is sent in the block.

Parameters:

Returns:

  • (Result)

    The operation response, if there is one.

Since:

  • 2.0.0



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

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