Skip to content

Commit

Permalink
fixup! rework Known limitations in doc + add GH issues
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Bajtoš <[email protected]>
  • Loading branch information
bajtos committed Sep 26, 2019
1 parent 46c5360 commit 644d33b
Showing 1 changed file with 62 additions and 31 deletions.
93 changes: 62 additions & 31 deletions docs/site/Importing-LB3-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,46 +37,77 @@ support applications that are unable to boot (throw errors at startup).

## Known limitations

- Connector-specific metadata in property definitions is not imported.
{% include note.html content="
Please up-vote the tracking GitHub issue for scenarios that are important to
your project. It will help us to better prioritize which limitations to remove
first.
" %}

### Connector-specific metadata in property definitions is not imported

_The tracking GitHub issue:
[loopback-next#3810](https://github.com/strongloop/loopback-next/issues/3810)_

Workaround: Add this metadata manually to the generated file.

### Nested properties are not upgraded

_The tracking GitHub issue:
[loopback-next#3811](https://github.com/strongloop/loopback-next/issues/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](https://github.com/strongloop/loopback-next/issues/3812)_

Workaround: define relational metadata & navigational properties manually.

### Models inheriting from custom base class

_The tracking GitHub issue:
[loopback-next#3813](https://github.com/strongloop/loopback-next/issues/3813)_

As a workaround, you can add this metadata manually to the generated file.
Models inheriting from application-specific models (including LB3 built-in
models like `User`) cannot be imported yet.

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

As a workaround, you can fix the generated definition manually.
1. Modify your LB3 model to inherit from `Model`, `PersistedModel` or
`KeyValueModel`.

- Model relations are not imported.
2. Import the model to LB4

As a workaround, you can define relational metadata & navigational properties
manually.
3. Update the imported model to inherit for the desired application-specific
model.

- Models inheriting from application-specific models (including LB3 built-in
models like `User`) cannot be imported yet.
### MongoDB's `ObjectID` type

As a workaround, you can modify your LB3 model to inherit from `Model`,
`PersistedModel` or `KeyValueModel`, then import the model and finally update
the generated model file to inherit for the desired application-specific
model.
The tracking GitHub issue:
[loopback-next#3814](https://github.com/strongloop/loopback-next/issues/3814).

- For models attached to MongoDB datasource, the imported LB4 model contains
incorrect definition of the primary key property of `ObjectID` type.
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:
As a workaround, you can change the property definition from:

```ts
@property({
type: ObjectID;
})
id: ObjectID;
```
```ts
@property({
type: ObjectID;
})
id: ObjectID;
```

to:
to:

```ts
@property({
type: 'string',
mongodb: {dataType: 'ObjectID'}
})
id: string;
```
```ts
@property({
type: 'string',
mongodb: {dataType: 'ObjectID'}
})
id: string;
```

0 comments on commit 644d33b

Please sign in to comment.