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
IMongoClientThe client.
options
ChangeStreamOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>>
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
IMongoClientThe client.
session
IClientSessionHandleThe session.
options
ChangeStreamOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>>
A change stream.