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

Remove on from schema reserved keys #11580

Closed
AbdelrahmanHafez opened this issue Mar 25, 2022 · 2 comments · Fixed by #11804
Closed

Remove on from schema reserved keys #11580

AbdelrahmanHafez opened this issue Mar 25, 2022 · 2 comments · Fixed by #11804
Assignees
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone

Comments

@AbdelrahmanHafez
Copy link
Collaborator

We need to verify that people can use on as a path in their schemas.

@vkarpov15
Copy link
Collaborator

I confirmed that you can use on as a schema path. You get a warning that you can suppress using the supressReservedKeysWarning option.

As far as Mongoose itself is concerned, we don't need to warn about on as a reserved key. Documents support $on as an alternative, and Mongoose uses $on internally in the couple of places where we use documents as event emitters internally. My only concern is plugins that rely on .on().

@AbdelrahmanHafez what do you think about removing on from reserved keys in a minor release?

@vkarpov15 vkarpov15 added enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature and removed note to self labels Apr 29, 2022
@vkarpov15 vkarpov15 changed the title https://github.com/Automattic/mongoose/pull/11565#issue-1179728465 Remove on from schema reserved keys Apr 29, 2022
@vkarpov15 vkarpov15 modified the milestones: 6.3.2, 6.x Unprioritized Apr 29, 2022
@AbdelrahmanHafez
Copy link
Collaborator Author

Nice.
Sounds good, there should be no risk in releasing this in a minor release. I'm anticipating that in a couple of years plugins will break due to those changes, but then again the fix is easy on the plugins' end. 👍

@vkarpov15 vkarpov15 modified the milestones: 6.x Unprioritized, 6.4 May 3, 2022
@IslandRhythms IslandRhythms linked a pull request May 13, 2022 that will close this issue
vkarpov15 added a commit that referenced this issue May 16, 2022
vkarpov15 added a commit that referenced this issue May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants