Module: Mongo::Operation::Write::WriteCommandEnabled

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

Overview

This module contains common functionality for operations that send either a write command or a specific wire protocol message, depending on server version. For server versions >= 2.6, a write command is sent.

Since:

  • 2.1.0

Instance Method Summary collapse

Instance Method Details

#execute(context) ⇒ Result

Execute the operation.

Examples:

Execute the operation.

operation.execute(context)

Parameters:

Returns:

  • (Result)

    The operation result.

Since:

  • 2.1.0



36
37
38
39
40
41
42
# File 'lib/mongo/operation/write/write_command_enabled.rb', line 36

def execute(context)
  if context.features.write_command_enabled?
    execute_write_command(context)
  else
    execute_message(context)
  end
end