Method Watch
Watch(IMongoDatabase, ChangeStreamOptions, CancellationToken)
Watches changes on all collection in a database.
public static IChangeStreamCursor<ChangeStreamDocument<BsonDocument>> Watch(this IMongoDatabase database, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)
Parameters
database
IMongoDatabaseThe database.
options
ChangeStreamOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>
A change stream.
Watch(IMongoDatabase, IClientSessionHandle, ChangeStreamOptions, CancellationToken)
Watches changes on all collection in a database.
public static IChangeStreamCursor<ChangeStreamDocument<BsonDocument>> Watch(this IMongoDatabase database, IClientSessionHandle session, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)
Parameters
database
IMongoDatabaseThe database.
session
IClientSessionHandleThe session.
options
ChangeStreamOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>
A change stream.