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
databaseIMongoDatabaseThe database.
optionsChangeStreamOptionsThe options.
cancellationTokenCancellationTokenThe 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
databaseIMongoDatabaseThe database.
sessionIClientSessionHandleThe session.
optionsChangeStreamOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>
A change stream.