TopologyDescription

public struct TopologyDescription

A struct describing the state of a MongoDB deployment: its type (standalone, replica set, or sharded), which servers are up, what type of servers they are, which is primary, and so on.

  • The possible types for a topology.

    See more

    Declaration

    Swift

    public enum TopologyType : String
  • The type of this topology.

    Declaration

    Swift

    public let type: TopologyType
  • The replica set name.

    Declaration

    Swift

    public var setName: String? { get }
  • The largest setVersion ever reported by a primary.

    Declaration

    Swift

    public var maxSetVersion: Int64?
  • The largest electionId ever reported by a primary.

    Declaration

    Swift

    public var maxElectionId: ObjectId?
  • The servers comprising this topology. By default, no servers.

    Declaration

    Swift

    public var servers: [ServerDescription]
  • For single-threaded clients, indicates whether the topology must be re-scanned.

    Declaration

    Swift

    public let stale: Bool
  • Exists if any server’s wire protocol version range is incompatible with the client’s.

    Declaration

    Swift

    public let compatibilityError: MongoError?
  • The logicalSessionTimeoutMinutes value for this topology. This value is the minimum of the logicalSessionTimeoutMinutes values across all the servers in servers, or nil if any of them are nil.

    Declaration

    Swift

    public var logicalSessionTimeoutMinutes: Int64? { get }
  • Returns true if the topology has a readable server available, and false otherwise.

    Declaration

    Swift

    public func hasReadableServer() -> Bool
  • Returns true if the topology has a writable server available, and false otherwise.

    Declaration

    Swift

    public func hasWritableServer() -> Bool