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

Document#toJSON ignores schema options of populated documents #1376

Closed
nkzawa opened this issue Mar 8, 2013 · 1 comment
Closed

Document#toJSON ignores schema options of populated documents #1376

nkzawa opened this issue Mar 8, 2013 · 1 comment
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.

Comments

@nkzawa
Copy link

nkzawa commented Mar 8, 2013

Schema options for populated documents are ignored when calling toJSON. Instead options for the document which calls toJSON are used. See the following test fails for the detail.

https://gist.github.com/nkzawa/5148103

I found that the cause is utils.clone uses a same options value for each mongoose objects.
This behavior is not intuitive.

@alexcason
Copy link

Same issue is also logged in #1412.

ebensing added a commit to mongodbinc-interns/mongoose that referenced this issue Aug 5, 2013
subdocuments and populated paths were using the parent's toJSON options
instead of their own. This fixes that.
ebensing added a commit to mongodbinc-interns/mongoose that referenced this issue Aug 21, 2013
subdocuments and populated paths were using the parent's toJSON options
instead of their own. This fixes that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.
Projects
None yet
Development

No branches or pull requests

2 participants