MongoDB Event Storage for node-cqrs
Usage
npm install node-cqrs node-cqrs-mongo --save
A configured instance of MongoEventStorage must be passed in as "storage" option to the EventStore constructor:
const EventStore = ;const MongoEventStorage = ; const storage = connectionString: 'mongodb://username:password@localhost:27017/db' eventsCollection: 'events'; const eventStore = storage ; eventStore;
The same, using DI container:
const EventStore Container = ;const MongoEventStorage = ; // create container instanceconst container = ; // register MongoEventStorage as "storage"container;container; // register EventStore as "eventStore"container; // commit events to eventStorecontainereventStore;