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

Deprecate setting schema paths to primitives (like 'foo: false') #7558

Closed
vkarpov15 opened this issue Feb 24, 2019 · 0 comments · Fixed by #12832
Closed

Deprecate setting schema paths to primitives (like 'foo: false') #7558

vkarpov15 opened this issue Feb 24, 2019 · 0 comments · Fixed by #12832
Labels
developer-experience This issue improves error messages, debugging, or reporting discussion If you have any thoughts or comments on this issue, please share them!
Milestone

Comments

@vkarpov15
Copy link
Collaborator

The below schema sets 'foo' to a mixed type:

new Schema({
  name: String,
  foo: false,
});

This is a potentially dangerous gotcha. We'll still allow _id: false as a special case, because that's become a pervasive meme in Mongoose projects and because we already handle it with this commit (re: #7480). But I think for 6.0 we should throw an error in the above case.

Relevant issues: #7512 #7516 #7480 #7524

@vkarpov15 vkarpov15 added discussion If you have any thoughts or comments on this issue, please share them! developer-experience This issue improves error messages, debugging, or reporting labels Feb 24, 2019
@vkarpov15 vkarpov15 added this to the 5.x Unprioritized milestone Feb 24, 2019
@vkarpov15 vkarpov15 modified the milestones: 6.x Unprioritized, 7.0 Mar 2, 2022
vkarpov15 added a commit to lpizzinidev/mongoose that referenced this issue Feb 4, 2023
vkarpov15 added a commit that referenced this issue Feb 4, 2023
fix(schema): Deprecated setting schema paths to primitive values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer-experience This issue improves error messages, debugging, or reporting discussion If you have any thoughts or comments on this issue, please share them!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant