module Mongo::Operation::OpMsgOrFindCommand
Shared behavior of executing the operation as an OpMsg when supported, as a Command
when find command is supported by the server, and as Legacy otherwise.
@api private
Public Instance Methods
execute(server)
click to toggle source
# File lib/mongo/operation/shared/op_msg_or_find_command.rb, line 26 def execute(server) operation = final_operation(server) operation.execute(server) end
Private Instance Methods
final_operation(server)
click to toggle source
# File lib/mongo/operation/shared/op_msg_or_find_command.rb, line 33 def final_operation(server) cls = if server.features.op_msg_enabled? polymorphic_class(self.class.name, :OpMsg) elsif server.features.find_command_enabled? polymorphic_class(self.class.name, :Command) else polymorphic_class(self.class.name, :Legacy) end cls.new(spec) end