IMPORTANT: There is an issue with the official MongoDB Compass client. When you try to connect to a ReplicaSet, it first correctly translates the MongoDB connection string (DNS) to localhost:PORT. However, once it reads the member hostnames (like in this script), it will attempt to connect to those hosts instead!
Usualy, the script would look like this: