@owservable/mongodb
v3.1.3
Published
owservable mongodb backend adapter: change streams, models and process models
Downloads
661
Readme
@owservable/mongodb
MongoDB backend adapter for @owservable/core: live data via MongoDB change streams over mongoose models.
🚀 Features
- MongoBackend: implements
IObservableBackendover a mongoose model — change feed, queries, populates, virtuals - MongoObservableModel / MongoObservableDatabase: resilient change-stream wrappers with automatic reconnection
- processMongoModels: scans per-module
models/folders, registers every model with theBackendRegistryandMongoCollectionsModelsMap - MongoDBConnector: mongoose connection lifecycle with pooling and logging
- Index helpers:
addMongoUpIndicesToAttributes,addMongoDownIndicesToAttributes,addMongoUpAndDownIndicesToAttributes
📦 Installation
npm install @owservable/core @owservable/mongodb mongooseor
pnpm add @owservable/core @owservable/mongodb mongoose@owservable/core, mongoose and rxjs are peer dependencies.
🔁 Migrating from owservable 2.x
The public API is database-prefixed in v3. The websocket wire protocol is unchanged — client applications need no changes.
| owservable 2.x | @owservable/mongodb 3.x |
|---|---|
| MongoDBConnector | MongoDBConnector (unchanged) |
| CollectionsModelsMap | MongoCollectionsModelsMap |
| processModels | processMongoModels |
| observableModel | observableMongoModel |
| observableDatabase | observableMongoDatabase |
| addIndexToAttributes | addMongoIndexToAttributes |
| addUpIndicesToAttributes | addMongoUpIndicesToAttributes |
| addDownIndicesToAttributes | addMongoDownIndicesToAttributes |
| addUpAndDownIndicesToAttributes | addMongoUpAndDownIndicesToAttributes |
Protocol-level pieces (OwservableClient, stores, DataMiddlewareMap, cronjobs/workers/watchers) moved to @owservable/core with their names unchanged.
📄 License
Unlicense — see LICENSE.
