-
Notifications
You must be signed in to change notification settings - Fork 15
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
Is it possible to NOT have this plugin run when doing a model.validate()? #19
Comments
Yep it possible via internal property __maiRunOnce mongoose-plugin-autoinc/src/index.js Line 322 in 80b4bb4
Before first valudation set it to true. And after that sdt it back to false. Anyway it will be nice if this feature will be avaliable via public API. Any suggestions about how it should be? |
fix bug: no support model validation |
@bigdong89 can you make PR where pre or post validation will work via some configuration option. Thanks. |
I package changed one as my own plugin in my product. |
Is it possible to NOT have this plugin run when doing a model.validate(), and only make it run on a save method? I'm using the model to carry out primary validation of an object before carrying out separate rules based validation. If both validation steps pass, then I save the entry into the DB. In this setup, the autoinc entries in the DB count up in 2's rather tha 1's.
The text was updated successfully, but these errors were encountered: