jerni a framework to build data-driven products from the ground up
Type: | MongoDbStore |
Namespace: | @jerni/store-mongo |
Extends: | jerni::Store |
Properties
getDriver:
([MongoDbReadModel]) => Promise<MongoDbReadOnlyCollection>
internal use: returns a read-only version of native mongodb collection object
Examples
const usersModel = require('../journey/models/users');/* ... */const UsersCollection = await journey.getReader(usersModel);const someUser = await UsersCollection.findOne({ id: '1000' });
handleEvents:
(CommittedEvent) => Promise<MongoDbOperation[]>
projects a batch of events into a batch of mongodb write operations, and idempotently apply those operations
inherited from jerni::Store
inherited from jerni::Store
name
: string
name of the store
inherited from jerni::Store
inherited from jerni::Store
getLastSeenId
: () => Promise<number>
returns the last fully persisted ID
inherited from jerni::Store
listen
: () => AsyncIterable<number>
returns an async iterable that yields with the latest fully persisted ID
inherited from jerni::Store
clean
: () => Promise<void>
cleans up storage layer. No effect in production mode
inherited from jerni::Store
toString
: () => string
returns a human-readable representation of the store
inherited from jerni::Store
dispose
: () => Promise<void>
cleans up all resouces created by this store instance. This will not clean up any data in storage layer