module Mongo::Operation::OpMsgOrCommand
Shared behavior of executing the operation as an OpMsg when supported or as a Command
otherwise.
@api private
Public Instance Methods
Source
# File lib/mongo/operation/shared/op_msg_or_command.rb, line 25 def execute(server, client:, options: {}) server.with_connection do |connection| operation = final_operation(connection) operation.execute(connection, client: client, options: options) end end
Private Instance Methods
Source
# File lib/mongo/operation/shared/op_msg_or_command.rb, line 34 def final_operation(connection) cls = if connection.features.op_msg_enabled? polymorphic_class(self.class.name, :OpMsg) else polymorphic_class(self.class.name, :Command) end cls.new(spec) end