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 isAsync
for validators
#6700
Comments
Hi @lorixx 4 of your 5 validators have Here are the relevant logs
|
Including a diff for clarity
|
Thank you so much @lineus ! Do you know why the async did not work the way I expected? I tried update the controllers/user.js in the controller level, but it still doesn't work with the async either:
Thanks again for your kind reply! |
You're welcome @lorixx ! The |
@lineus Thanks! Now I understand why!! Actually from this wiki: http://mongoosejs.com/docs/validation.html#async-custom-validators On a follow-up note thou, I wish we can have a more explicit error to inform this misuse. |
In general, we should really deprecate |
isAsync
for validators
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
I have some simple code that is trying to save a user into db:
However, the callback is never called, I am on Nodejs v8.9.4, MongoDB 4.0 and Mongoose 5.2.2
If the current behavior is a bug, please provide the steps to reproduce.
I uploaded the full code in my github repo here: https://github.com/lorixx/node-express-mongoose-demo
The issue is reproducible by just registering a new user after running the web app.
See the above line 369 is NEVER getting called at all.
Instead, after I step-in during debugging, we get into this
Kareem
codepath then nothing else happen after I step-out.We can reproduce this by signing up a new user here from the above screen, the request is hang and never got completed.
What is the expected behavior?
The user should be saved successfully with the right callback.
Please mention your node.js, mongoose and MongoDB version.
I am on Nodejs v8.9.4, MongoDB 4.0 and Mongoose 5.2.2.
The initial startup connection to MongoDB also works fine, see the printout below from console:
Thanks!
The text was updated successfully, but these errors were encountered: