module Mongo::Operation::PolymorphicOperation
Shared behavior of implementing an operation differently based on the server that will be executing the operation.
@api private
Public Instance Methods
execute(server, context:, options: {})
click to toggle source
Execute the operation.
@param [ Mongo::Server
] server The server to send the operation to. @param [ Operation::Context
] context The operation context. @param [ Hash ] options Operation
execution options.
@return [ Mongo::Operation::Result
] The operation result.
# File lib/mongo/operation/shared/polymorphic_operation.rb, line 34 def execute(server, context:, options: {}) server.with_connection(service_id: context.service_id) do |connection| operation = final_operation(connection) operation.execute(connection, context: context, options: options) end end