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 gotchas regarding typekey and fields named "type" #8227

Closed
captaincaius opened this issue Oct 8, 2019 · 1 comment
Closed

Document gotchas regarding typekey and fields named "type" #8227

captaincaius opened this issue Oct 8, 2019 · 1 comment
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation
Milestone

Comments

@captaincaius
Copy link
Contributor

Do you want to request a feature or report a bug?

Neither ;) documentation.

What is the current behavior?

I noticed in code that there's special-case code for allowing fields called "type" - detected by type being a POJO with a field that's also called "type"...

  1. This special-case workaround isn't documented
  2. If we DO document it, we should mention that the workaround only currently works in the case that typeKey is default ("type").

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?

I think the most logical way would be to mention both points here and reiterate the caveat of point 2 here

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.

master branch

@vkarpov15
Copy link
Collaborator

The docs we have are here: https://mongoosejs.com/docs/faq.html#type-key . We'll add notes to the schema type docs

@vkarpov15 vkarpov15 added this to the 5.7.5 milestone Oct 13, 2019
@vkarpov15 vkarpov15 added the docs This issue is due to a mistake or omission in the mongoosejs.com documentation label Oct 13, 2019
@vkarpov15 vkarpov15 modified the milestones: 5.7.5, 5.7.6 Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation
Projects
None yet
Development

No branches or pull requests

2 participants