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