property MongoAdapterOptionsBase.collections
Since 0.1.0

Per-entity collection and primary-key overrides, keyed by the entity name passed to getRepository().

An entity with no entry uses its own name as the collection and 'id' as the key, which is why the zero-config path works for a schema whose collection names already match — the D1 two-layer shape.

Examples

Example 1

new MongoAdapter({
  url: 'mongodb://127.0.0.1:27017/app',
  collections: { User: { collection: 'users', primaryKey: 'user_id', idType: 'raw' } },
});

Type

Readonly<Record<string, MongoEntityMapping>>

Usage

import { type MongoAdapterOptionsBase } from "database-plugin/src/index.ts";