This error means the connection to your MongoDB cluster was closed before the initial setup completed. The most common source of this error is a missing Atlas whitelist entry for the public IP address where Compass is running.
When a new project is created in Atlas, you must create an IP whitelist for security purposes. If there is no IP whitelist, or it does not include the public IP address where Compass is running, this error message is displayed when attempting to connect.
You can easily add our current IP address in the Atlas UI under Clusters: Security: IP Whitelist. Click the green
ADD IP ADDRESS button.
Then click the
ADD CURRENT IP ADDRESS button.
Finally, click the green
Confirm button and wait 5 to 10 minutes for Atlas to update the IP Whitelist for your project. Please note the IP address above is an example and you should use your current public IP address or IP address range in CIDR notation.
For more information, refer the documentation, Add Entries to the Whitelist, and the tutorial Configuring your IP whitelist in MongoDB Atlas.