modulepackage
0.0.0-20210830191712-7c007b022138
Repository: https://github.com/gjongenelen/eh-mongodb.git
Documentation: pkg.go.dev
# README
eh-mongodb
This package is based on the default mongo-driver in EventHorizon. Mongo has a document limit of 16MB which can easily be reached in big projects, resulting in aggregates with many events not being saved.
The default mongo-driver in EventHorizon stores an aggregate with its events in one single document, increasing the size of the document on each event. This driver creates a new document per event, preventing documents from growing and reaching the limit mentioned above.
# Functions
NewEventStore creates a new EventStore with a MongoDB URI: `mongodb://hostname`.
NewEventStoreWithClient creates a new EventStore with a client.
# Variables
ErrCouldNotClearDB is when the database could not be cleared.
ErrCouldNotDialDB is when the database could not be dialed.
ErrCouldNotLoadAggregate is when an aggregate could not be loaded.
ErrCouldNotMarshalEvent is when an event could not be marshaled into BSON.
ErrCouldNotSaveAggregate is when an aggregate could not be saved.
ErrCouldNotUnmarshalEvent is when an event could not be unmarshaled into a concrete type.
ErrNoDBClient is when no database client is set.
# Structs
EventStore implements an EventStore for MongoDB.