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

Property.array(ObjectId) #587

Closed
Limpidius-Fred opened this issue Jul 13, 2020 · 2 comments
Closed

Property.array(ObjectId) #587

Limpidius-Fred opened this issue Jul 13, 2020 · 2 comments
Labels

Comments

@Limpidius-Fred
Copy link

Steps to reproduce

  class MyModel {
    @property.array(String, {
      default: [],
      mongodb: {dataType: 'ObjectID'},
    }) relatedIds: string[];
  }

Current Behavior

relatedIds writes strings[] into MongoDb

Expected Behavior

relatedIds should write ObjectId[] into MongoDb

Additional information

This looks like correcting the problem (mongodb.js#36, function ObjectId):

  if (typeof id !== 'string') {
    return Array.isArray(id) ? id.map(ObjectID) : id;
  }

@agnes512
Copy link
Contributor

agnes512 commented Aug 4, 2020

I think this is fixed in #582 and released in version 5.3.0. Thanks.

@agnes512 agnes512 closed this as completed Aug 4, 2020
@agnes512
Copy link
Contributor

agnes512 commented Aug 4, 2020

Similar issue: loopbackio/loopback-next#5848

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