Table of Contents

Class ClusterDescription

Namespace
MongoDB.Driver.Core.Clusters
Assembly
MongoDB.Driver.Core.dll

Represents information about a cluster.

public sealed class ClusterDescription : IEquatable<ClusterDescription>
Inheritance
ClusterDescription
Implements
Inherited Members

Constructors

ClusterDescription(ClusterId, ClusterConnectionMode, ClusterType, IEnumerable<ServerDescription>)

Initializes a new instance of the ClusterDescription class.

[Obsolete("Use the constructor that has a directConnection parameter.")]
public ClusterDescription(ClusterId clusterId, ClusterConnectionMode connectionMode, ClusterType type, IEnumerable<ServerDescription> servers)

Parameters

clusterId ClusterId

The cluster identifier.

connectionMode ClusterConnectionMode

The connection mode.

type ClusterType

The type.

servers IEnumerable<ServerDescription>

The servers.

ClusterDescription(ClusterId, ClusterConnectionMode, Exception, ClusterType, IEnumerable<ServerDescription>)

Initializes a new instance of the ClusterDescription class.

[Obsolete("Use the constructor that has a directConnection parameter.")]
public ClusterDescription(ClusterId clusterId, ClusterConnectionMode connectionMode, Exception dnsMonitorException, ClusterType type, IEnumerable<ServerDescription> servers)

Parameters

clusterId ClusterId

The cluster identifier.

connectionMode ClusterConnectionMode

The connection mode.

dnsMonitorException Exception

The last DNS monitor exception (null if there was none).

type ClusterType

The type.

servers IEnumerable<ServerDescription>

The servers.

ClusterDescription(ClusterId, bool?, Exception, ClusterType, IEnumerable<ServerDescription>)

Initializes a new instance of the ClusterDescription class.

public ClusterDescription(ClusterId clusterId, bool? directConnection, Exception dnsMonitorException, ClusterType type, IEnumerable<ServerDescription> servers)

Parameters

clusterId ClusterId

The cluster identifier.

directConnection bool?

Whether to make a direct connection.

dnsMonitorException Exception

The last DNS monitor exception (null if there was none).

type ClusterType

The type.

servers IEnumerable<ServerDescription>

The servers.

Properties

ClusterId

Gets the cluster identifier.

public ClusterId ClusterId { get; }

Property Value

ClusterId

ConnectionMode

Gets the connection mode.

[Obsolete("Use DirectConnection instead.")]
public ClusterConnectionMode ConnectionMode { get; }

Property Value

ClusterConnectionMode

ConnectionModeSwitch

Gets the connection mode switch.

[Obsolete("This property will be removed in a later release.")]
public ConnectionModeSwitch ConnectionModeSwitch { get; }

Property Value

ConnectionModeSwitch

DirectConnection

Gets the DirectConnection.

public bool? DirectConnection { get; }

Property Value

bool?

DnsMonitorException

Gets the last DNS monitor exception (null if there was none).

public Exception DnsMonitorException { get; }

Property Value

Exception

IsCompatibleWithDriver

Gets a value indicating whether this cluster is compatible with the driver.

public bool IsCompatibleWithDriver { get; }

Property Value

bool

true if this cluster is compatible with the driver; otherwise, false.

IsDirectConnection

Gets whether the connection mode or the direct connection flag are configured as a direct connection.

public bool IsDirectConnection { get; }

Property Value

bool

LogicalSessionTimeout

Gets the logical session timeout.

public TimeSpan? LogicalSessionTimeout { get; }

Property Value

TimeSpan?

Servers

Gets the servers.

public IReadOnlyList<ServerDescription> Servers { get; }

Property Value

IReadOnlyList<ServerDescription>

State

Gets the cluster state.

public ClusterState State { get; }

Property Value

ClusterState

Type

Gets the cluster type.

public ClusterType Type { get; }

Property Value

ClusterType

Methods

Equals(ClusterDescription)

public bool Equals(ClusterDescription other)

Parameters

other ClusterDescription

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

WithDnsMonitorException(Exception)

Returns a new ClusterDescription with a changed DnsMonitorException.

public ClusterDescription WithDnsMonitorException(Exception value)

Parameters

value Exception

The exception.

Returns

ClusterDescription

A ClusterDescription.

WithServerDescription(ServerDescription)

Returns a new ClusterDescription with a changed ServerDescription.

public ClusterDescription WithServerDescription(ServerDescription value)

Parameters

value ServerDescription

The server description.

Returns

ClusterDescription

A ClusterDescription.

WithType(ClusterType)

Returns a new ClusterDescription with a changed ClusterType.

public ClusterDescription WithType(ClusterType value)

Parameters

value ClusterType

The value.

Returns

ClusterDescription

A ClusterDescription.

WithoutServerDescription(EndPoint)

Returns a new ClusterDescription with a ServerDescription removed.

public ClusterDescription WithoutServerDescription(EndPoint endPoint)

Parameters

endPoint EndPoint

The end point of the server description to remove.

Returns

ClusterDescription

A ClusterDescription.