def command(operation, opts = {})
      txn_read_pref = if opts[:session] && opts[:session].in_transaction?
        opts[:session].txn_read_preference
      else
        nil
      end
      txn_read_pref ||= opts[:read] || ServerSelector::PRIMARY
      Lint.validate_underscore_read_preference(txn_read_pref)
      preference = ServerSelector.get(txn_read_pref)

      client.send(:with_session, opts) do |session|
        read_with_retry(session, preference) do |server|
          Operation::Command.new({
            :selector => operation.dup,
            :db_name => name,
            :read => preference,
            :session => session
          }).execute(server)
        end
      end
    end
def command(operation, opts = {})
      txn_read_pref = if opts[:session] && opts[:session].in_transaction?
        opts[:session].txn_read_preference
      else
        nil
      end
      txn_read_pref ||= opts[:read] || ServerSelector::PRIMARY
      Lint.validate_underscore_read_preference(txn_read_pref)
      preference = ServerSelector.get(txn_read_pref)

      client.send(:with_session, opts) do |session|
        read_with_retry(session, preference) do |server|
          Operation::Command.new({
            :selector => operation.dup,
            :db_name => name,
            :read => preference,
            :session => session
          }).execute(server)
        end
      end
    end
Execute a command on the database.

 @example Execute a command.
   database.command(:ismaster => 1)

 @param [ Hash ] operation The command to execute.
 @param [ Hash ] opts The command options.

 @option opts :read [ Hash ] The read preference for this command.
 @option opts :session [ Session ] The session to use for this command.

 @return [ Hash ] The result of the command execution.