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

Error when schema discriminators are used on embedded array fields #3

Closed
catchshyam opened this issue Feb 5, 2018 · 2 comments
Closed

Comments

@catchshyam
Copy link

Hi,

One of my schema uses the discriminators as elaborated in this blog http://thecodebarbarian.com/mongoose-4.8-embedded-discriminators.html.

When I use such a schema with nest-mongoose, I get the following error,

....\node_modules@nestjs\mongoose\mongoose.utils.js:4
return ${JSON.stringify(model)}Model;
^
TypeError: Converting circular structure to JSON

I guess the code for generating model token will have to be changed since the schema JSON can not be serialized when there are discriminators.

Thanks.

@silvelo
Copy link
Contributor

silvelo commented Feb 7, 2018

The way to generate the token have to much problems I make PR to solve #4 but this solve this problem too.

Lets wait to @kamilmysliwiec to give us more info about this, beacuse the change had a break change.

@kamilmysliwiec
Copy link
Member

Fixed thanks to #5 by @silvelo. I'll push it together with the incoming release 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants