Method Watch
Watch<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in all databases.
public IChangeStreamCursor<TResult> Watch<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)
Parameters
pipeline
PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>The pipeline.
options
ChangeStreamOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IChangeStreamCursor<TResult>
A change stream.
Type Parameters
TResult
The type of the result.
Watch<TResult>(IClientSessionHandle, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in all databases.
public IChangeStreamCursor<TResult> Watch<TResult>(IClientSessionHandle session, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
pipeline
PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>The pipeline.
options
ChangeStreamOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IChangeStreamCursor<TResult>
A change stream.
Type Parameters
TResult
The type of the result.