Navigation

mongocli atlas cluster connectionString describe

The cluster connectionString describe command retrieves the unique connection string specific to the specified Atlas cluster. You can also retrieve the connection string using the Atlas UI and API.

mongocli atlas cluster connectionString|cs describe|get <cluster-name>
[ --output|-o <output-format> ]
[ --type <connection-string-type> ]
[ --profile|-P <profile-name> ]
[ --projectId <project-ID> ]
Note

Use -h or --help to view the command-line help for this command.

Option
Type
Description
Required?
<cluster-name>
string
Name of the cluster.
yes
Option
Type
Description
Required?
--output, -o
string

Command output format. Valid values are:

  • json for output in JSON format
  • go-template for custom output using the Go template
  • go-template-file for custom output specified using the Go template file

If omitted, the command returns output in the default format.

no
--profile, -P
string
Name of the profile where the public and private keys for the project are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI.
no
--projectId
string

Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable.

no
--type
string

Type of connection string to retrieve. You can specify one of the following:

If omitted, defaults to standard.

no

If the command succeeds, the command prints the following to the terminal in the default format.

STANDARD CONNECTION STRING
<connection-string>

If the command succeeds, the command prints the following fields if you requested output in JSON format.

Option
Type
Description
standard
string
Public mongodb:// connection string for the cluster.
standardSrv
string

Public mongodb+srv:// connection string for the cluster. The mongodb+srv protocol tells the driver to look up the seed List of hosts in DNS. Atlas synchronizes this list with the nodes in a cluster. If the connection string uses this URI format, you don't need to:

  • Append the seed list or
  • Change the URI if the nodes change.

You can use this URI format if your driver supports it.

If the command returns errors, see Troubleshooting for recommended solutions.

The following examples use the mongocli atlas cluster cs describe command to retrieve the standard connection string for a cluster named myCluster in the default format and JSON format. It uses the default profile to access the project.

mongocli atlas cluster cs describe myCluster

The previous command prints the following output to the terminal:

STANDARD CONNECTION STRING
mongodb+srv://myCluster.7hgjn.mongodb.net
Give Feedback