-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
why connect() does not return a promise ? #3622
Comments
You're right, worth adding this. |
probably the same goes for disconnect() |
+1 |
2 similar comments
+1 |
+1 |
make connect/open/openSet/disconnect return a promise, fixes #3622
@vkarpov15 How to handle Example: mongoose.connect('mongodb://127.0.0.2/test')
.then(() => {
return server.start();
})
.catch(err => { // <---- we will not be here...
console.error('App starting error:', err.stack);
process.exit(1);
}); Workaround: mongoose.connect('mongodb://127.0.0.2/test', function() { /* dummy function */ })
.then(() => {
return server.start();
})
.catch(err => { // mongoose connection error will be handled here
console.error('App starting error:', err.stack);
process.exit(1);
}); |
@Jokero that's odd. Can you open up a separate issue for this? |
Since most of the api is promised, i was wondering why connect() function is not.
It looks bad (example: https://gist.github.com/davibe/8986a865a96005fa2467)
The text was updated successfully, but these errors were encountered: