Repository navigation
Release v22.136.0
Observing MongoDB collections no longer opens a change stream, and holds a pooled connection, for every subscription. All observations of a database now share one change stream.
Changed
Observe,ObserveSingleandObserveByIdonIMongoCollectionnow use the shared per-database change stream owned byIMongoDBWatcher, with no configuration. A page with 30 observable queries holds one change stream instead of 30.- Observations attach to the shared stream before their initial query, so a change made while it runs is applied afterwards instead of lost.
- Inserts into an observed collection are now checked against the observed filter with one lookup by id, as updates already were, because the shared stream cannot be narrowed by it. Observations that take every document skip the lookup.
IMongoDBWatcherhas a newGetChanges(string databaseName)member that exposes the shared stream. Custom implementations of the interface must add it.- A failed shared stream reconnects with backoff and resumes from its last change, so a transient connection failure no longer ends collection observations.