Method WatchAsync
WatchAsync(IMongoClient, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in all databases.
public static Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>> WatchAsync(this IMongoClient client, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)
Parameters
client
IMongoClient The client.
options
ChangeStream Options The options.
cancellationToken
CancellationToken The cancellation token.
Returns
- Task<IChange
Stream <ChangeCursor Stream <BsonDocument Document >>> A change stream.
WatchAsync(IMongoClient, IClientSessionHandle, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in all databases.
public static Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>> WatchAsync(this IMongoClient client, IClientSessionHandle session, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)
Parameters
client
IMongoClient The client.
session
IClientSession Handle The session.
options
ChangeStream Options The options.
cancellationToken
CancellationToken The cancellation token.
Returns
- Task<IChange
Stream <ChangeCursor Stream <BsonDocument Document >>> A change stream.