This page outlines how to use MongoDB Compass to connect to a MongoDB host. You can connect to a standalone, replica set, or sharded cluster host.
If you need to create a MongoDB host, consider using MongoDB Atlas. Atlas is a cloud-hosted database-as-a-service which requires no installation, offers a free tier to get started, and provides a copyable URI to easily connect Compass to your deployment.
If you need to install Compass, see Download and Install Compass for instructions.
When connecting Compass to a replica set, it is not recommended to connect directly to an individual replica set member. If the member to which you are connected switches from a primary member to a secondary or vice versa as the result of an election, Compass may either forcibly close the connection or display stale data.
Instead, to connect to a replica set, use either the replica set SRV record or Replica Set Name when filling in your connection information.
- Starting in MongoDB Compass 1.19, Compass displays a warning message when connected to non-genuine MongoDB instances as these instances may behave differently from the official MongoDB instances; e.g. missing or incomplete features, different feature behaviors, etc.
When you open Compass, an initial connection dialog appears:
Compass provides two methods to connect to your deployment, either providing your deployment connection string or filling in your deployment information in specific fields.
MongoDB Compass securely stores sensitive information entered in the connection form using an API that is specific to your operating system.
For more information on how Compass handles sensitive data, refer to the FAQ page.
Disconnecting from a MongoDB instance closes the Compass connection to the active instance and returns the Compass view to the initial connection dialog.