Page Contents


To simplify migration from LoopBack 3, LoopBack 4 provides a CLI tool to import LoopBack 3 models into your LoopBack 4 project.


Import one or more models from your LB 3.x application by running lb4 import-lb3-models command.


lb3app: Path to the directory containing your LoopBack 3.x application.


outDir: Directory where to write the generated source file. Default: src/models

Known limitations

Nested properties are not upgraded

The tracking GitHub issue: loopback-next#3811

When a property is defined with a complex object type, the nested property definitions are not converted from LB3 to LB4 format.

Workaround: Fix the generated definition manually.

Model relations are not imported

The tracking GitHub issue: loopback-next#3812

Workaround: define relational metadata & navigational properties manually.

MongoDB’s ObjectID type

The tracking GitHub issue: loopback-next#3814.

For models attached to MongoDB datasource, the imported LB4 model contains incorrect definition of the primary key property of ObjectID type.

As a workaround, you can change the property definition from:

  type: ObjectID;
id: ObjectID;


  type: 'string',
  mongodb: {dataType: 'ObjectID'}
id: string;

Some settings cannot be imported

The following fields from model settings are not supported by LoopBack 4 and therefore ignored during import:

  • acls
  • methods
  • mixins
  • validations