Connection issue with mongoose db error for multiple host names

I am trying to connect to a mongodb atlas free cluster. however the error tells me that connection string can not contain multiple hostnames.
I am dirrectly copying atlas connection string and replacing password. I have no idea where does multiple hostnames come from.
my code looks like this:
mongoose.connect(dbUrl, {useNewUrlParser: true,

useUnifiedTopology: true,

useFindAndModify: false,

 useCreateIndex: true

}).then((res) => console.log(res)).catch((error) => console.log(error));

my dbUrl is mongodb+srv://erdem:@mongootrial.dcxhh.mongodb.net/myFirstDatabase?retryWrites=true&w=majority

Does your password have any special characters?
You have to escape those or try a simple password and see if it works

1 Like

Thanks it worked. I tought . , is not spetial character but it seems so.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.