property MongoEntityMapping.primaryKey

The primary-key field name(s). Defaults to 'id'.

A scalar names a single-column key (the driver's _id maps to that one field). An array names a composite key: each named column is a top-level field on the collection (idType absent) or, when idType: 'compound', the keys of the subdocument stored under the driver's _id in the mapping's declared order (P4/P5).

Type

string | readonly string[]

Usage

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