Table of Contents

Method Watch

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Watch(IMongoDatabase, ChangeStreamOptions, CancellationToken)

Watches changes on all collection in a database.

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

Parameters

database IMongoDatabase

The database.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>

A change stream.

Watch(IMongoDatabase, IClientSessionHandle, ChangeStreamOptions, CancellationToken)

Watches changes on all collection in a database.

public static IChangeStreamCursor<ChangeStreamDocument<BsonDocument>> Watch(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

IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>

A change stream.