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

Problem with mongoose model serialization #149

Closed
jselesan opened this issue May 19, 2017 · 2 comments
Closed

Problem with mongoose model serialization #149

jselesan opened this issue May 19, 2017 · 2 comments
Milestone

Comments

@jselesan
Copy link
Contributor

Hi!. I'm using routing-controllers with mongoose, but when my controller returns the result of a query, the _id field of the models are serialized as

{"_id":{"_bsontype":"ObjectID","id":{"0":89,"1":17,"2":175,"3":60,"4":137,"5":110,"6":193,"7":50,"8":29,"9":2,"10":180,"11":121}}

My method is:

@Get("/")
  all() {
      return this.usersService.getAll().then( users => users.map(u => u.toJSON()) );
  }

I think that the problem is the class transformer, but I don't know how to fix it

@jselesan
Copy link
Contributor Author

I'm sorry. Just disabled the classTransformer on the options and all works fine for me.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants