Interface IMongoDBWatcher
- Namespace
- Cratis.Arc.MongoDB
- Assembly
- Cratis.Arc.MongoDB.dll
Defines a system that maintains a single change stream connection per database per process, allowing multiple collection observations to share the same underlying change stream.
public interface IMongoDBWatcher
- Extension Methods
Methods
GetChanges(string)
Gets the changes of the shared change stream for a database, starting the stream when it is not already open.
IObservable<ChangeStreamDocument<BsonDocument>> GetChanges(string databaseName)
Parameters
databaseNamestringName of the database whose changes to get.
Returns
- IObservable<ChangeStreamDocument<BsonDocument>>
A hot IObservable<T> of every change in the database, across all of its collections.
Remarks
Every subscription to one database shares a single change stream, so subscribing costs no database connection. A subscriber sees only changes that arrive after it subscribed.
Observe<TDocument>(Expression<Func<TDocument, bool>>?)
Start observing a collection using the shared database-level change stream.
IMongoDBObserveBuilder<TDocument> Observe<TDocument>(Expression<Func<TDocument, bool>>? filter = null)
Parameters
filterExpression<Func<TDocument, bool>>Optional filter expression for the documents to observe.
Returns
- IMongoDBObserveBuilder<TDocument>
A IMongoDBObserveBuilder<TDocument> for chaining joins and finalizing the observation.
Type Parameters
TDocumentType of document to observe.