Instance Propertymongokitten 7.9.5MongoClient
connectionState
The current state of the cluster’s connection pool
Cluster.swift:93var connectionState: MongoConnectionState { get }
Other members in extension
Type members
init(connectingTo: ConnectionSettings, allowFailure: Bool, logger: Logger, eventLoopGroup: _MongoPlatformEventLoopGroup
) async throws Connects to a cluster immediately, and awaits connection readiness.
init(lazyConnectingTo: ConnectionSettings, logger: Logger, eventLoopGroup: _MongoPlatformEventLoopGroup
) throws Connects to a cluster lazily, which means you don’t know if the connection was successful until you start querying. This is useful when you need a cluster synchronously to query asynchronously
Show implementation details (1)
Hide implementation details
Instance members
var checkLivelinessTimeAmount: TimeInterval?
var didRediscover: (() -> ())?
Triggers every time the cluster rediscovers
var heartbeatFrequency: TimeAmount
The interval at which cluster discovery is triggered, at a minimum of 500 milliseconds
let logger: Logger
var onStateChange: ((ClusterState) -> ())?
Triggers every time the cluster rediscovers
let sessionManager: MongoSessionManager
var settings: ConnectionSettings
The settings used to connect to MongoDB.
var slaveOk: Bool
When set to true, read queries are also executed on slave instances of MongoDB
var wireVersion: WireVersion?
The WireVersion used by this cluster’s nodes
func disconnect(
) async Closes all connections, and stops polling for cluster changes.
func next(for: ConnectionPoolRequest
) async throws -> MongoConnection Gets a connection from the pool, or creates a new one if none are available. The returned connection matches the requirements of the request.
func reconnect(
) async throws Prompts
MongoCluster
to close all connections, and connect to the remote(s) again.