Table of Contents

Interface ICluster

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

Represents a MongoDB cluster.

public interface ICluster : IDisposable
Inherited Members

Properties

ClusterId

Gets the cluster identifier.

ClusterId ClusterId { get; }

Property Value

ClusterId

The cluster identifier.

CryptClient

Gets the crypt client.

CryptClient CryptClient { get; }

Property Value

CryptClient

A crypt client.

Description

Gets the cluster description.

ClusterDescription Description { get; }

Property Value

ClusterDescription

The cluster description.

Settings

Gets the cluster settings.

ClusterSettings Settings { get; }

Property Value

ClusterSettings

The cluster settings.

Methods

AcquireServerSession()

Acquires a core server session.

ICoreServerSession AcquireServerSession()

Returns

ICoreServerSession

A core server session.

Initialize()

Initializes the cluster.

void Initialize()

SelectServer(IServerSelector, CancellationToken)

Selects a server from the cluster.

IServer SelectServer(IServerSelector selector, CancellationToken cancellationToken)

Parameters

selector IServerSelector

The server selector.

cancellationToken CancellationToken

The cancellation token.

Returns

IServer

The selected server.

SelectServerAsync(IServerSelector, CancellationToken)

Selects a server from the cluster.

Task<IServer> SelectServerAsync(IServerSelector selector, CancellationToken cancellationToken)

Parameters

selector IServerSelector

The server selector.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IServer>

A Task representing the operation. The result of the Task is the selected server.

StartSession(CoreSessionOptions)

Starts a session.

ICoreSessionHandle StartSession(CoreSessionOptions options = null)

Parameters

options CoreSessionOptions

The options.

Returns

ICoreSessionHandle

A session.

Events

DescriptionChanged

Occurs when the cluster description has changed.

event EventHandler<ClusterDescriptionChangedEventArgs> DescriptionChanged

Event Type

EventHandler<ClusterDescriptionChangedEventArgs>