even when I directly put the mongo db url, it still doesn’t work:
mongoose
.connect('mongodb+srv://username:jSnSniWBTlbu4SjX@hostname.fepglzk.mongodb.net/?retryWrites=true&w=majority')
.then(() => {
app.listen(port)
console.log('MongoDB connected successfully.');
})
.catch((err) => {
console.error('Failed to connect to MongoDB:', err);
});
I get the same error