-
-
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
cannot connect to mongo db when node version > 17 #11250
Labels
help
This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary
Comments
import * as mongoose from 'mongoose';
mongoose.connection.on('connected', () => {
console.log('connected')
});
mongoose.connection.on('error', () => {
console.log('error')
})
async function run() {
await mongoose.connect('mongodb://localhost:27017');
console.log('done');
}
run(); |
IslandRhythms
added
the
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
label
Jan 19, 2022
Looks like the same problem reported there? Also this seems to be a new intended behavior in node 17 I think. |
@sean-daley is right, #11066 (comment) is the answer. 3 options:
Looks like Node v17 changed up the resolution order in nodejs/node#40537, which is why this started happening for you in node v17. |
vkarpov15
added
help
This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary
and removed
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
labels
Feb 11, 2022
tks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
help
This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary
when using node 17 my application cannot connect to MongoDB
script of example
running this simple connection with your
MONGO_URI
should return the error below:For some reason, my environment was on node 17. When I come back to the LTS version 16 returns to works normally.
The text was updated successfully, but these errors were encountered: