Method Watch
Watch<TDocument>(IMongoCollection<TDocument>, ChangeStreamOptions, CancellationToken)
Watches changes on the collection.
public static IChangeStreamCursor<ChangeStreamDocument<TDocument>> Watch<TDocument>(this IMongoCollection<TDocument> collection, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)
Parameters
collection
IMongoCollection<TDocument>The collection.
options
ChangeStreamOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IChangeStreamCursor<ChangeStreamDocument<TDocument>>
A change stream.
Type Parameters
TDocument
The type of the document.
Watch<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, ChangeStreamOptions, CancellationToken)
Watches changes on the collection.
public static IChangeStreamCursor<ChangeStreamDocument<TDocument>> Watch<TDocument>(this IMongoCollection<TDocument> collection, IClientSessionHandle session, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)
Parameters
collection
IMongoCollection<TDocument>The collection.
session
IClientSessionHandleThe session.
options
ChangeStreamOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IChangeStreamCursor<ChangeStreamDocument<TDocument>>
A change stream.
Type Parameters
TDocument
The type of the document.