Table of Contents

Class ClusterSettings

Namespace
MongoDB.Driver.Core.Configuration
Assembly
MongoDB.Driver.Core.dll

Represents settings for a cluster.

public class ClusterSettings
Inheritance
ClusterSettings
Inherited Members

Constructors

ClusterSettings(Optional<ClusterConnectionMode>, Optional<ConnectionModeSwitch>, Optional<CryptClientSettings>, Optional<bool?>, Optional<IEnumerable<EndPoint>>, Optional<bool>, Optional<TimeSpan>, Optional<int>, Optional<string>, Optional<ServerApi>, Optional<TimeSpan>, Optional<IServerSelector>, Optional<IServerSelector>, Optional<ConnectionStringScheme>, Optional<int>)

Initializes a new instance of the ClusterSettings class.

public ClusterSettings(Optional<ClusterConnectionMode> connectionMode = default, Optional<ConnectionModeSwitch> connectionModeSwitch = default, Optional<CryptClientSettings> cryptClientSettings = default, Optional<bool?> directConnection = default, Optional<IEnumerable<EndPoint>> endPoints = default, Optional<bool> loadBalanced = default, Optional<TimeSpan> localThreshold = default, Optional<int> maxServerSelectionWaitQueueSize = default, Optional<string> replicaSetName = default, Optional<ServerApi> serverApi = default, Optional<TimeSpan> serverSelectionTimeout = default, Optional<IServerSelector> preServerSelector = default, Optional<IServerSelector> postServerSelector = default, Optional<ConnectionStringScheme> scheme = default, Optional<int> srvMaxHosts = default)

Parameters

connectionMode Optional<ClusterConnectionMode>

The connection mode.

connectionModeSwitch Optional<ConnectionModeSwitch>

The connection mode switch.

cryptClientSettings Optional<CryptClientSettings>

Crypt client settings.

directConnection Optional<bool?>

The directConnection.

endPoints Optional<IEnumerable<EndPoint>>

The end points.

loadBalanced Optional<bool>

The load balanced.

localThreshold Optional<TimeSpan>

The local threshold.

maxServerSelectionWaitQueueSize Optional<int>

Maximum size of the server selection wait queue.

replicaSetName Optional<string>

Name of the replica set.

serverApi Optional<ServerApi>

The server API.

serverSelectionTimeout Optional<TimeSpan>

The server selection timeout.

preServerSelector Optional<IServerSelector>

The pre server selector.

postServerSelector Optional<IServerSelector>

The post server selector.

scheme Optional<ConnectionStringScheme>

The connection string scheme.

srvMaxHosts Optional<int>

Limits the number of SRV records used to populate the seedlist during initial discovery, as well as the number of additional hosts that may be added during SRV polling.

Properties

ConnectionMode

Gets the connection mode.

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

Property Value

ClusterConnectionMode

The connection mode.

ConnectionModeSwitch

Gets the connection mode switch.

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

Property Value

ConnectionModeSwitch

CryptClientSettings

Gets the crypt client settings.

public CryptClientSettings CryptClientSettings { get; }

Property Value

CryptClientSettings

DirectConnection

Gets the DirectConnection.

public bool? DirectConnection { get; }

Property Value

bool?

EndPoints

Gets the end points.

public IReadOnlyList<EndPoint> EndPoints { get; }

Property Value

IReadOnlyList<EndPoint>

The end points.

LoadBalanced

Gets whether to use load balanced.

public bool LoadBalanced { get; }

Property Value

bool

LocalThreshold

Gets the local threshold.

public TimeSpan LocalThreshold { get; }

Property Value

TimeSpan

The local threshold.

MaxServerSelectionWaitQueueSize

Gets the maximum size of the server selection wait queue.

public int MaxServerSelectionWaitQueueSize { get; }

Property Value

int

The maximum size of the server selection wait queue.

PostServerSelector

Gets the post server selector.

public IServerSelector PostServerSelector { get; }

Property Value

IServerSelector

The post server selector.

PreServerSelector

Gets the pre server selector.

public IServerSelector PreServerSelector { get; }

Property Value

IServerSelector

The pre server selector.

ReplicaSetName

Gets the name of the replica set.

public string ReplicaSetName { get; }

Property Value

string

The name of the replica set.

Scheme

Gets the connection string scheme.

public ConnectionStringScheme Scheme { get; }

Property Value

ConnectionStringScheme

The connection string scheme.

ServerApi

Gets the server API.

public ServerApi ServerApi { get; }

Property Value

ServerApi

The server API.

ServerSelectionTimeout

Gets the server selection timeout.

public TimeSpan ServerSelectionTimeout { get; }

Property Value

TimeSpan

The server selection timeout.

SrvMaxHosts

Limits the number of SRV records used to populate the seedlist during initial discovery, as well as the number of additional hosts that may be added during SRV polling.

public int SrvMaxHosts { get; }

Property Value

int

Methods

With(Optional<ClusterConnectionMode>, Optional<ConnectionModeSwitch>, Optional<CryptClientSettings>, Optional<bool?>, Optional<IEnumerable<EndPoint>>, Optional<bool>, Optional<TimeSpan>, Optional<int>, Optional<string>, Optional<ServerApi>, Optional<TimeSpan>, Optional<IServerSelector>, Optional<IServerSelector>, Optional<ConnectionStringScheme>, Optional<int>)

Returns a new ClusterSettings instance with some settings changed.

public ClusterSettings With(Optional<ClusterConnectionMode> connectionMode = default, Optional<ConnectionModeSwitch> connectionModeSwitch = default, Optional<CryptClientSettings> cryptClientSettings = default, Optional<bool?> directConnection = default, Optional<IEnumerable<EndPoint>> endPoints = default, Optional<bool> loadBalanced = default, Optional<TimeSpan> localThreshold = default, Optional<int> maxServerSelectionWaitQueueSize = default, Optional<string> replicaSetName = default, Optional<ServerApi> serverApi = default, Optional<TimeSpan> serverSelectionTimeout = default, Optional<IServerSelector> preServerSelector = default, Optional<IServerSelector> postServerSelector = default, Optional<ConnectionStringScheme> scheme = default, Optional<int> srvMaxHosts = default)

Parameters

connectionMode Optional<ClusterConnectionMode>

The connection mode.

connectionModeSwitch Optional<ConnectionModeSwitch>

The connection mode switch.

cryptClientSettings Optional<CryptClientSettings>

Crypt client settings.

directConnection Optional<bool?>

The directConnection.

endPoints Optional<IEnumerable<EndPoint>>

The end points.

loadBalanced Optional<bool>

The load balanced.

localThreshold Optional<TimeSpan>

The local threshold.

maxServerSelectionWaitQueueSize Optional<int>

Maximum size of the server selection wait queue.

replicaSetName Optional<string>

Name of the replica set.

serverApi Optional<ServerApi>

The server API.

serverSelectionTimeout Optional<TimeSpan>

The server selection timeout.

preServerSelector Optional<IServerSelector>

The pre server selector.

postServerSelector Optional<IServerSelector>

The post server selector.

scheme Optional<ConnectionStringScheme>

The connection string scheme.

srvMaxHosts Optional<int>

Limits the number of SRV records used to populate the seedlist during initial discovery, as well as the number of additional hosts that may be added during SRV polling.

Returns

ClusterSettings

A new ClusterSettings instance.