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