lib/mongo/server.rb
# Disconnect the driver from this server.
#
# Disconnects all idle connections to this server in its connection pool,
# if any exist. Stops the populator of the connection pool, if it is
# running. Does not immediately close connections which are presently
# checked out (i.e. in use) - such connections will be closed when they
# are returned to their respective connection pools. Stop the server's
# background monitor.
#
# @return [ true ] Always true.
#
# @since 2.0.0
Disconnect the driver from this server.
Disconnects all idle connections to this server in its connection pool,
if any exist. Stops the populator of the connection pool, if it is
running. Does not immediately close connections which are presently
checked out  - such connections will be closed when they
are returned to their respective connection pools. Stop the server's
background monitor.
Disconnect the driver from this server . Disconnects all idle connections to this server in its connection pool if any exist . Stops the populator of the connection pool if it is running . Does not immediately close connections which are presently checked out - such connections will be closed when they are returned to their respective connection pools . Stop the server ' s background monitor .
def disconnect!
      if monitor
        monitor.stop!
      end
      _pool = @pool_lock.synchronize do
        @pool
      end
      if _pool
        begin
          _pool.disconnect!(stop_populator: true)
        rescue Error::PoolClosedError
        end
      end
      @connected = false
      true
    end
def disconnect! if monitor monitor . stop! end _pool = @pool_lock . synchronize do @pool end if _pool begin _pool . disconnect! ( stop_populator : true ) rescue Error :: PoolClosedError end end @connected = false true end
Disconnect the driver from this server.
Disconnect the driver from this server .
# For backwards compatibility we disconnect/clear the pool rather # than close it here. We also stop the populator which allows the # the pool to continue providing connections but stops it from # connecting in background on clients/servers that are in fact # intended to be closed and no longer used. # If the pool was already closed, we don't need to do anything here.
None
 true 
since
None