Package Exports
- @node-ts/bus-mongodb
- @node-ts/bus-mongodb/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@node-ts/bus-mongodb) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@node-ts/bus-mongodb
A Mongodb based persistence for workflow storage in @node-ts/bus
🔥 View our docs at https://bus.node-ts.com 🔥
🤔 Have a question? Join the Discussion 🤔
Installation
Install all packages and their dependencies
npm install @node-ts/bus-mongodb
Configure a new Mongodb persistence and register it with Bus
:
import { Bus } from '@node-ts/bus-core'
import { MongodbPersistence, MongodbConfiguration } from '@node-ts/bus-mongodb'
const configuration: MongodbConfiguration = {
connection: 'mongodb://localhost:27017',
databaseName: 'workflows'
}
const mongodbPersistence = new MongodbPersistence(configuration)
// Configure bus to use mongodb as a persistence
const run = async () => {
const bus = Bus
.configure()
.withPersistence(mongodbPersistence)
.build()
await bus.initialize()
await bus.start()
}
run.then(() => void)
Configuration Options
The Mongodb persistence has the following configuration:
- connection (required) The mongodb connection string to use. This can be a single server, a replica set, or a mongodb+srv connection.
- schemaName (required) The database name to create workflow collections inside.
Development
Local development can be done with the aid of docker to run the required infrastructure. To do so, run:
docker run --name bus-mongodb -p 27017:27017 -d mongo