Skip to main content

Function: resolveCollectionName()

resolveCollectionName(clazz): string

Defined in: service-core/src/database/NamingUtils.ts:39

Resolves the name of the database collection (or table) that records of the given model class are stored in.

The name is resolved using the following rules:

  1. The nearest class in the inheritance chain (starting with clazz itself) that specifies an explicit entity name via the @Entity(options) decorator.
  2. Otherwise, the most ancestral class in the inheritance chain that declares its own @DataStore binding. This ensures that @ChildEntity subclasses are stored in the same collection as their parent entity (single collection inheritance).
  3. Otherwise, the snake_case form of the class name.

Parameters

clazz

any

The model class to resolve the collection name for.

Returns

string