Table of Contents

Method WatchAsync

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

WatchAsync(IMongoDatabase, ChangeStreamOptions, CancellationToken)

Watches changes on all collection in a database.

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

Parameters

database IMongoDatabase

The database.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>>

A change stream.

WatchAsync(IMongoDatabase, IClientSessionHandle, ChangeStreamOptions, CancellationToken)

Watches changes on all collection in a database.

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

Parameters

database IMongoDatabase

The database.

session IClientSessionHandle

The session.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>>

A change stream.