module Mongo::Operation::Write::Command::Writable
Provides common behavior for write commands. Assigns an operation id when executed.
@since 2.0.0
Public Instance Methods
execute(context)
click to toggle source
Execute the operation. The context gets a connection on which the operation is sent in the block.
@param [ Mongo::Server::Context ] context The context for this operation.
@return [ Result ] The operation response, if there is one.
@since 2.0.0
# 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
Private Instance Methods
message()
click to toggle source
The wire protocol message for this write operation.
@return [ Mongo::Protocol::Query ] Wire protocol message.
@since 2.0.0
# File lib/mongo/operation/write/command/writable.rb, line 49 def message Protocol::Query.new(db_name, Database::COMMAND, selector, options) end