Skip to content

Docs: how to configure a custom table/collection name different from model class name #2197

@johntom

Description

@johntom

Description / Steps to reproduce

loopback 4
node 10.14.2
npm 6.4.1
win10
I have a pre existing mongo db database containing all lower case collections. The scaffolding used in tutorial examples assumes a Proper Case collection. I would like to use a lowercase collection name, from Todo > todo

Current Behavior

The collection appearas as Todo in mongo following the example given

Expected Behavior

I want to the model, controller and repository use the lowercase name of todo and not Todo..

Acceptance Criteria (Added by LoopBack team)

  • Add content on how to configure the @model decorator when the model name is different from the table name
  • Add content on how to configure the @property decorator when the property name is different from the column name.

Note: This sample repo https://github.com/dhmlau/loopback4-example-todo-customized can be used as a reference.

Things to be discussed:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions