-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
In LB3, the type of the primary key is determined by the connector. The MongoDB connector defines the type as ObjectID, using a class provided by MongoDB (bson module).
Conceptually:
{
"name": "Product",
"properties": {
"id": {
"id": true,
"generated": true,
"type": ObjectID
}
}
}In LB4, we treat ObjectID values differently:
- the property type is set to
string - there is MongoDB-specific metadata to tell the connector to use
ObjectIDdata-type for this property
@property({
type: 'string',
id: true,
generated: true,
mongodb: {dataType: 'ObjectID'},
})
id: string;We need to improve the importer to detect ObjectID properties and convert them to LB4 format.
This task depends on #3810 LB3 model import: preserve connector-specific metadata in property definitions, because we need to define connector-specific metadata.
Acceptance criteria
-
Implement conversion of primary key (id) properties -
Check how are foreign keys handled, implement conversion for them too if needed -
Consider converting all properties withObjectIDtype, regardless of whether they are PK/FK or not - if we see the property as ObjectID, we convert it to the appropriate mapping.
- Update
Importing-LB3-models.md, remove the relevant point from the list of known limitations
jgutix