Skip to content

tonyfromundefined/nact-persistence-mongodb

Repository files navigation

NAct Logo

nact-persistence-mongodb

A MongoDB persistence plugin for NAct.

Usage

import { MongoClient } from "mongodb";
import { MongoDBPersistenceEngine } from "nact-persistence-mongodb";

const mongoClient = new MongoClient("...");

const system = start(
  configurePersistence(
    new MongoDBPersistenceEngine(mongoClient, {
      dbName: "...", // optional
      dbOptions: { ... }, // optional
      eventsCollectionName: "nact_events", // optional
      eventsCollectionOptions: { ... }, // optional
      snapshotsCollectionName: "nact_snapshots", // optional
      snapshotsCollectionOptions: { ... }, // optional
    }),
  ),
);

References