Table of Contents

Method Watch

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Watch<TResult>(PipelineDefinition<ChangeStreamDocument<TDocument>, TResult>, ChangeStreamOptions, CancellationToken)

Watches changes on the collection.

IChangeStreamCursor<TResult> Watch<TResult>(PipelineDefinition<ChangeStreamDocument<TDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

pipeline PipelineDefinition<ChangeStreamDocument<TDocument>, TResult>

The pipeline.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IChangeStreamCursor<TResult>

A change stream.

Type Parameters

TResult

The type of the result.

Watch<TResult>(IClientSessionHandle, PipelineDefinition<ChangeStreamDocument<TDocument>, TResult>, ChangeStreamOptions, CancellationToken)

Watches changes on the collection.

IChangeStreamCursor<TResult> Watch<TResult>(IClientSessionHandle session, PipelineDefinition<ChangeStreamDocument<TDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

pipeline PipelineDefinition<ChangeStreamDocument<TDocument>, TResult>

The pipeline.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IChangeStreamCursor<TResult>

A change stream.

Type Parameters

TResult

The type of the result.