Error connecting to database: MongoServerSelectionError: connection <monitor> to 52.88.89.97:27017 closed

I’m getting this error when I’m using render or railway. So far I’ve tested both the connection string and network connectivity which both work. mongodb+srv://sruthfd:a5cffDxHPfTH6gpl@cluster0.npqhxto.mongodb.net/?retryWrites=true&w=majority

This error indicates the driver fails to find a server based on your preference (e.g. read preference).

What read preference you use? by default it should be primary, can you check if you have a primary running

i never use atlas. is your deployment a replica set or sharded cluster?

check this. https://www.mongodb.com/docs/manual/core/read-preference-mechanics/

It’s a replica set with two secondary and one primary cluster.