Table of Contents

Class IMongoClientExtensions

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Extension methods on IMongoClient.

public static class IMongoClientExtensions
Inheritance
IMongoClientExtensions
Inherited Members

Methods

Watch(IMongoClient, ChangeStreamOptions, CancellationToken)

Watches changes on all collections in all databases.

public static IAsyncCursor<ChangeStreamDocument<BsonDocument>> Watch(this IMongoClient client, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

client IMongoClient

The client.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<ChangeStreamDocument<BsonDocument>>

A change stream.

Watch(IMongoClient, IClientSessionHandle, ChangeStreamOptions, CancellationToken)

Watches changes on all collections in all databases.

public static IAsyncCursor<ChangeStreamDocument<BsonDocument>> Watch(this IMongoClient client, IClientSessionHandle session, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

client IMongoClient

The client.

session IClientSessionHandle

The session.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<ChangeStreamDocument<BsonDocument>>

A change stream.

WatchAsync(IMongoClient, ChangeStreamOptions, CancellationToken)

Watches changes on all collections in all databases.

public static Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>> WatchAsync(this IMongoClient client, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

client IMongoClient

The client.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>>

A change stream.

WatchAsync(IMongoClient, IClientSessionHandle, ChangeStreamOptions, CancellationToken)

Watches changes on all collections in all databases.

public static Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>> WatchAsync(this IMongoClient client, IClientSessionHandle session, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

client IMongoClient

The client.

session IClientSessionHandle

The session.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>>

A change stream.