Server selection timed out after 30000 ms - Chapter 2 Atlas

Hi

Im getting the error

Server selection timed out after 30000 ms

I can connect happily using shell (and imported js data set) but when I use compass I get the timeout message

Help !

thanks Simon

By the way @simonloach, I’ve just assigned your topic to the M001 course because it was unassigned. Feel free to change it if my assumption was wrong.

1 Like

Hi @simonloach,

Can you please share the SRV connection string of your sandbox cluster along with the credentials?

Also, did you face any difficulty in connecting to the class atlas cluster from Compass ?

Thanks,
Shubham Ranjan
Curriculum Services Engineer

Hi

connection string is

mongodb://m001-student:m001-mongdn-basics@cluster0-shard-00-01-fsqm7.mongodb.net:27017/?authSource=admin&readPreference=primary&appname=MongoDB%20Compass&ssl=true

From what I remember it seemed to connect to the class cluster from compass just fine

many thanks

Simon

There was a typo in the password, I used the below string and it connected just fine:

 mongo mongodb+srv://m001-student:m001-mongodb-basics@cluster0-fsqm7.mongodb.net:27017

Few things here:

  • You used just a single node address: cluster0-shard-00-01-fsqm7.mongodb.net, its always better to use the server address as a whole like I did in the string above.
  • With that, if you are mentioning readPreference in the connection string, it will look for primary first, that is also one of the reasons the string was not able to connect.

Kanika

1 Like

thanks will try it when I get home tonight :slight_smile:

1 Like