Click or drag to resize

MongoDatabaseBase.Watch<TResult> Method (IClientSessionHandle, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)

Watches changes on all collections in a database.

Namespace:  MongoDB.Driver
Assembly:  MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.20.0+ee01960089f28ea1b501690df5fc9f6318a70242
Syntax
public virtual IChangeStreamCursor<TResult> Watch<TResult>(
	IClientSessionHandle session,
	PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline,
	ChangeStreamOptions options = null,
	CancellationToken cancellationToken = null
)

Parameters

session
Type: MongoDB.Driver.IClientSessionHandle
The session.
pipeline
Type: MongoDB.Driver.PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>
The pipeline.
options (Optional)
Type: MongoDB.Driver.ChangeStreamOptions
The options.
cancellationToken (Optional)
Type: System.Threading.CancellationToken
The cancellation token.

Type Parameters

TResult
The type of the result.

Return Value

Type: IChangeStreamCursor<TResult>
A change stream.

Implements

IMongoDatabase.Watch<TResult>(IClientSessionHandle, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)
See Also