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

[Feature] Document#validate(...) pathsToSkip option to exclude fields #10353

Closed
AbdelrahmanHafez opened this issue Jun 14, 2021 · 3 comments
Closed
Labels
new feature This change adds new functionality, like a new method or class
Milestone

Comments

@AbdelrahmanHafez
Copy link
Collaborator

Currently, we can make an inclusive list of fields that we want to validate using pathsToValidate.

It would be nice if we could have an option to skip specific fields pathsToSkip, and a user can either select fields to skip, or fields to validate, never both.

@vkarpov15 What do you think? I'd happily work on that if accepted.

@IslandRhythms
Copy link
Collaborator

I believe that has been merged already.
#10276

@IslandRhythms IslandRhythms added seen discussion If you have any thoughts or comments on this issue, please share them! and removed seen labels Jun 14, 2021
@AbdelrahmanHafez
Copy link
Collaborator Author

Oh, I was sure I've seen that feature but couldn't use it. Didn't know it was merged to 5.13.

I'll keep this issue open because I'd like to add the option to the documentation, index.d.ts, and also make it usable by Model.validate(...) and Document#validateSync(...).

@vkarpov15
Copy link
Collaborator

@AbdelrahmanHafez please feel free to work on this and put in a PR against the 5.13 branch 👍

@vkarpov15 vkarpov15 added this to the 5.13 milestone Jun 17, 2021
@vkarpov15 vkarpov15 added new feature This change adds new functionality, like a new method or class and removed discussion If you have any thoughts or comments on this issue, please share them! labels Jun 17, 2021
AbdelrahmanHafez added a commit to AbdelrahmanHafez/mongoose that referenced this issue Jun 19, 2021
vkarpov15 added a commit that referenced this issue Aug 1, 2023
feature: `pathsToSkip` option for Model.validate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature This change adds new functionality, like a new method or class
Projects
None yet
Development

No branches or pull requests

3 participants