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
Error connecting to database: MongoServerSelectionError: connection <monitor> to 126.96.36.199:27017 closed
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.