Table of Contents

Method WatchAsync

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

WatchAsync<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)

Watches changes on all collections in all databases.

public override Task<IChangeStreamCursor<TResult>> WatchAsync<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

pipeline PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>

The pipeline.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IChangeStreamCursor<TResult>>

A change stream.

Type Parameters

TResult

The type of the result.

WatchAsync<TResult>(IClientSessionHandle, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)

Watches changes on all collections in all databases.

public override Task<IChangeStreamCursor<TResult>> WatchAsync<TResult>(IClientSessionHandle session, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

pipeline PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>

The pipeline.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IChangeStreamCursor<TResult>>

A change stream.

Type Parameters

TResult

The type of the result.