MongoDatabaseContextGuard

class MongoDatabaseContextGuard(database: MongoDatabase)

Enforces the default deployment invariant that one MongoDB database belongs to one bounded context.

Physical aggregate and prepare collection names intentionally omit the bounded context. A durable ownership marker prevents independently deployed bounded contexts from silently sharing the same database. Existing unmarked databases are checked for foreign-context documents in every aggregate collection before the marker is claimed.

Constructors

Link copied to clipboard
constructor(database: MongoDatabase)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun ensureContext(contextName: String)