lib/mongo/server.rb
def unknown!(options = {})
      if load_balancer?
        # When the client is in load-balanced topology, servers (the one and
        # only that can be) starts out as a load balancer and stays as a
        # load balancer indefinitely. As such it is not marked unknown.
        #
        # However, this method also clears connection pool for the server
        # when the latter is marked unknown, and this part needs to happen
        # when the server is a load balancer.
        if service_id = options[:service_id]
          pool.disconnect!(service_id: service_id)
        elsif Lint.enabled?
          raise Error::LintError, 'Load balancer was asked to be marked unknown without a service id'
        end
        return
      end

      if options[:generation] && options[:generation] < pool.generation
        return
      end

      if options[:topology_version] && description.topology_version &&
        !options[:topology_version].gt?(description.topology_version)
      then
        return
      end

      if options[:stop_push_monitor]
        monitor&.stop_push_monitor!
      end

      # SDAM flow will update description on the server without in-place
      # mutations and invoke SDAM transitions as needed.
      config = {}
      if options[:service_id]
        config['serviceId'] = options[:service_id]
      end
      if options[:topology_version]
        config['topologyVersion'] = options[:topology_version]
      end
      new_description = Description.new(address, config,
        load_balancer: load_balancer?,
        force_load_balancer: options[:connect] == :load_balanced,
      )
      cluster.run_sdam_flow(description, new_description, options)
    end
# Marks server unknown and publishes the associated SDAM event
# (server description changed).
#
# If the generation is passed in options, the server will only be marked
# unknown if the passed generation is no older than the current generation
# of the server's connection pool.
#
# @param [ Hash ] options Options.
#
# @option options [ Integer ] :generation Connection pool generation of
#   the connection that was used for the operation that produced the error.
# @option options [ true | false ] :keep_connection_pool Usually when the
#   new server description is unknown, the connection pool on the
#   respective server is cleared. Set this option to true to keep the
#   existing connection pool (required when handling not master errors
#   on 4.2+ servers).
# @option options [ Object ] :service_id Discard state for the specified
#   service id only.
# @option options [ TopologyVersion ] :topology_version Topology version
#   of the error response that is causing the server to be marked unknown.
# @option options [ true | false ] :stop_push_monitor Whether to stop
#   the PushMonitor associated with the server, if any.
# @option options [ Object ] :service_id Discard state for the specified
#   service id only.
#
# @since 2.4.0, SDAM events are sent as of version 2.7.0
Marks server unknown and publishes the associated SDAM event
(server description changed).

If the generation is passed in options, the server will only be marked
unknown if the passed generation is no older than the current generation
of the server's connection pool.
Marks server unknown and publishes the associated SDAM event ( server description changed ) . If the generation is passed in options the server will only be marked unknown if the passed generation is no older than the current generation of the server ' s connection pool .
def unknown!(options = {})
      if load_balancer?
         However, this method also clears connection pool for the server
         when the latter is marked unknown, and this part needs to happen
         when the server is a load balancer.
        if service_id = options[:service_id]
          pool.disconnect!(service_id: service_id)
        elsif Lint.enabled?
          raise Error::LintError, 'Load balancer was asked to be marked unknown without a service id'
        end
        return
      end
      if options[:generation] && options[:generation] < pool.generation
        return
      end
      if options[:topology_version] && description.topology_version &&
        !options[:topology_version].gt?(description.topology_version)
      then
        return
      end
      if options[:stop_push_monitor]
        monitor&.stop_push_monitor!
      end
       SDAM flow will update description on the server without in-place
       mutations and invoke SDAM transitions as needed.
      config = {}
      if options[:service_id]
        config['serviceId'] = options[:service_id]
      end
      if options[:topology_version]
        config['topologyVersion'] = options[:topology_version]
      end
      new_description = Description.new(address, config,
        load_balancer: load_balancer?,
        force_load_balancer: options[:connect] == :load_balanced,
      )
      cluster.run_sdam_flow(description, new_description, options)
    end
def unknown! ( options = { } ) if load_balancer? if service_id = options [ :service_id ] pool . disconnect! ( service_id : service_id ) elsif Lint . enabled? raise Error :: LintError , 'Load balancer was asked to be marked unknown without a service id' end return end if options [ :generation ] && options [ :generation ] < pool . generation return end if options [ :topology_version ] && description . topology_version && ! options [ :topology_version ] . gt? ( description . topology_version ) then return end if options [ :stop_push_monitor ] monitor &. stop_push_monitor! end config = { } if options [ :service_id ] config [ 'serviceId' ] = options [ :service_id ] end if options [ :topology_version ] config [ 'topologyVersion' ] = options [ :topology_version ] end new_description = Description . new ( address , config , load_balancer : load_balancer? , force_load_balancer : options [ :connect ] == :load_balanced , ) cluster . run_sdam_flow ( description , new_description , options ) end
Marks server unknown and publishes the associated SDAM event
(server description changed).
Marks server unknown and publishes the associated SDAM event ( server description changed ) .
# When the client is in load-balanced topology, servers (the one and # only that can be) starts out as a load balancer and stays as a # load balancer indefinitely. As such it is not marked unknown. # # However, this method also clears connection pool for the server # when the latter is marked unknown, and this part needs to happen # when the server is a load balancer. # SDAM flow will update description on the server without in-place # mutations and invoke SDAM transitions as needed.
options
:service_id Discard state for the specified service id only.
: service_id Discard state for the specified service id only .
None
since
2.4.0, SDAM events are sent as of version 2.7.0
2 . 4 . 0 SDAM events are sent as of version 2 . 7 . 0