Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LB3 model import: handle ObjectID type for MongoDB #3814

Closed
5 tasks
bajtos opened this issue Sep 26, 2019 · 3 comments
Closed
5 tasks

LB3 model import: handle ObjectID type for MongoDB #3814

bajtos opened this issue Sep 26, 2019 · 3 comments
Labels

Comments

@bajtos
Copy link
Member

bajtos commented Sep 26, 2019

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 ObjectID data-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 with ObjectID type, 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
@dhmlau
Copy link
Member

dhmlau commented Nov 22, 2019

Moving to 2020Q1 as the blocking items are not target for Q4.

@stale
Copy link

stale bot commented Dec 25, 2020

This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.

@stale stale bot added the stale label Dec 25, 2020
@stale
Copy link

stale bot commented Jul 14, 2021

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this as completed Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants