Articles on: Database & Storage

MongoDB Compass: How to connect?

MongoDB Compass: How to Connect


Connecting MongoDB Compass to your database on Square Cloud requires an extra layer of security via TLS/SSL. Unlike a local connection, cloud databases require certificates to validate that communication between your computer and the server is encrypted and secure.



1. What You Will Need


Before opening Compass, make sure you have the following on hand:

  • The connection URL: Available in your Square Cloud dashboard.
  • The certificate file (.pem): This file is provided by Square Cloud in your database tab.



2. Preparing the Certificates


On Square Cloud, you receive a .pem file. For MongoDB Compass, this file plays two fundamental roles in the security tab:


  1. Certificate Authority (CA): Validates the Square server.
  2. Client Certificate/Key: Validates your connection as authorized.


You will use the same .pem file for both fields in the advanced configuration.



3. Step-by-Step Connection


Step 1: Enter the Connection String

Open Compass and, in the "New Connection" field, paste your URL. It should follow this format:

mongodb://default:{password}@square-cloud-db-{id}.squareweb.app:{port}


Step 2: Advanced TLS Settings

Don't click "Connect" yet! Click on "Advanced Connection Options" and navigate to the "TLS/SSL" tab.


  1. Under TLS/SSL, select the On option.
  2. In the Certificate Authority (.pem) field, click "Select file" and select your .pem file.
  3. In the Client Certificate and Key (.pem) field, click "Select file" and select the same .pem file again.


Step 3: Finish

Now, click Connect. Compass will validate the certificates and open the management interface for your collections.



4. Troubleshooting Tips


  • File Path: Avoid moving the .pem file to another folder after configuring the connection, otherwise Compass won't be able to find it during the next access.

Updated on: 05/22/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!