TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Eventuous/eventuous/llms.txt
Use this file to discover all available pages before exploring further.
Eventuous.Projections.MongoDB package integrates Eventuous subscriptions with MongoDB, providing a strongly-typed projector base class and a checkpoint store so your subscription positions survive restarts. It is not an event store itself — it is designed to hold read models built from events stored elsewhere (typically KurrentDB or PostgreSQL).
Installation
Core types at a glance
| Type | Role |
|---|---|
MongoProjector<T> | Abstract base class; register per-event handlers via On<>() |
MongoCheckpointStore | Persists subscription checkpoints in a MongoDB collection |
ProjectedDocument | Required base record for all MongoDB read-model documents |
MongoCollectionName | Convention-based collection name resolver |
Setting up IMongoDatabase
Register a configured IMongoDatabase instance in the DI container. The sample below shows a helper method that reads the connection string from configuration:
Projected documents
Every document stored by aMongoProjector<T> must extend ProjectedDocument:
Writing a projector
ExtendMongoProjector<T> and call On<TEvent>() inside the constructor to register each event type you want to handle. The framework calls the registered handler whenever an event of that type passes through the subscription pipeline.
MongoOperationBuilder<TEvent, T> fluent API supports InsertOne, UpdateOne, DeleteOne, and Bulk operations. Use Id(...) to target a document by its _id field, or Filter(...) for arbitrary filter expressions.
Collection naming
MongoCollectionName.For<T>() generates a camelCase collection name by stripping common suffixes (Document, Entity, View, Projection, ProjectionDocument, ProjectionEntity) from the type name. For example, BookingDocument becomes the collection Booking.
Override the collection name via MongoProjectionOptions<T>:
Checkpoint store
MongoCheckpointStore saves the last processed subscription position in a MongoDB collection (default collection name: checkpoint). Use it when your read models live in the same MongoDB instance to avoid managing a separate checkpoint store.
MongoCheckpointStoreOptions controls batching behaviour, which can significantly reduce write pressure for high-throughput subscriptions:
| Property | Default | Description |
|---|---|---|
CollectionName | "checkpoint" | Collection that holds checkpoint documents |
BatchSize | 1 | Checkpoint commits are batched up to this count |
BatchIntervalSec | 5 | Checkpoint commits are flushed at least every N seconds |
Registration
Register the projector and checkpoint store as part of a subscription:UseCheckpointStore<MongoCheckpointStore>() resolves MongoCheckpointStore from the DI container, which in turn requires IMongoDatabase and ILoggerFactory to be registered. Both are available by default in an ASP.NET Core application.