Skip to content

Commit e7089b2

Browse files
DOCSP-14136 doc for atlas cluster connectionString describe cmd (#493)
* DOCSP-14136 doc for atlas cluster connectionString describe cmd * DOCSP-14136 updates for copy review feedback * DOCSP-14136 updates for feedback
1 parent 2d2320d commit e7089b2

File tree

2 files changed

+193
-0
lines changed

2 files changed

+193
-0
lines changed

source/reference/atlas/cluster-commands.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Atlas ``cluster`` Commands
1717
Pause a Cluster </reference/atlas/cluster-pause>
1818
Resume a Cluster </reference/atlas/cluster-start>
1919
Watch a Cluster </reference/atlas/cluster-watch>
20+
Retrieve the Connection String for a Cluster </reference/atlas/cluster-connectionstring-describe>
2021
Atlas Search </reference/atlas/search-commands>
2122
Online Archives </reference/atlas/onlinearchive-commands>
2223
Create a Rolling Index </reference/atlas/clusters-indexes-create>
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
.. _mcli-atlas-cluster-cs-describe-cmd:
2+
3+
================================================
4+
mongocli atlas cluster connectionString describe
5+
================================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
The ``cluster connectionString describe`` command retrieves the unique
16+
connection string specific to the specified |service| cluster. You
17+
can also retrieve the connection string using the |service|
18+
:atlas:`UI </tutorial/connect-to-your-cluster/>` and :atlas:`API
19+
</reference/api/clusters-get-one/>`.
20+
21+
.. _mcli-atlas-cluster-cs-describe-syntax:
22+
23+
Syntax
24+
------
25+
26+
.. code-block:: shell
27+
28+
mongocli atlas cluster connectionString|cs describe|get <cluster-name>
29+
[ --output|-o <output-format> ]
30+
[ --type <connection-string-type> ]
31+
[ --profile|-P <profile-name> ]
32+
[ --projectId <project-ID> ]
33+
34+
.. include:: /includes/fact-command-line-help.rst
35+
36+
.. _mcli-atlas-cluster-cs-describe-args:
37+
38+
Arguments
39+
---------
40+
41+
.. list-table::
42+
:header-rows: 1
43+
:widths: 20 10 60 10
44+
45+
* - Option
46+
- Type
47+
- Description
48+
- Required?
49+
50+
* - ``<cluster-name>``
51+
- string
52+
- Name of the cluster.
53+
- yes
54+
55+
.. _mcli-atlas-cluster-cs-describe-options:
56+
57+
Options
58+
-------
59+
60+
.. list-table::
61+
:header-rows: 1
62+
:widths: 20 10 60 10
63+
64+
* - Option
65+
- Type
66+
- Description
67+
- Required?
68+
69+
* - ``--output``, ``-o``
70+
- string
71+
- .. include:: /includes/extracts/fact-basic-options-output.rst
72+
- no
73+
74+
* - ``--profile``, ``-P``
75+
- string
76+
- Name of the profile where the public and private
77+
keys for the project are saved. If omitted, uses the
78+
{+default-profile+}. To learn more about creating a
79+
profile, see :ref:`mcli-configure`.
80+
- no
81+
82+
* - ``--projectId``
83+
- string
84+
- .. include:: /includes/extracts/fact-basic-options-project-id.rst
85+
- no
86+
87+
* - ``--type``
88+
- string
89+
- Type of connection string to retrieve. You can specify one of
90+
the following:
91+
92+
- ``standard`` - for public :manual:`connection string
93+
</reference/connection-string/>` (default)
94+
- ``private`` - for :atlas:`private-endpoint-aware
95+
</security-private-endpoint/#std-label-private-endpoint-connection-strings>`
96+
:manual:`connection string </reference/connection-string/>`.
97+
98+
If omitted, defaults to ``standard``.
99+
100+
- no
101+
102+
.. _mcli-atlas-cluster-cs-describe-output:
103+
104+
Output
105+
------
106+
107+
If the command succeeds, the command prints the following to the terminal in the default format.
108+
109+
.. code-block:: shell
110+
:copyable: false
111+
112+
STANDARD CONNECTION STRING
113+
<connection-string>
114+
115+
If the command succeeds, the command prints the following fields if you
116+
requested output in |json| format.
117+
118+
.. list-table::
119+
:header-rows: 1
120+
:widths: 20 10 70
121+
122+
* - Option
123+
- Type
124+
- Description
125+
126+
* - ``standard``
127+
- string
128+
- Public ``mongodb://`` :manual:`connection string
129+
</reference/connection-string/>` for the cluster.
130+
131+
* - ``standardSrv``
132+
- string
133+
- Public ``mongodb+srv://`` :manual:`connection string
134+
</reference/connection-string/>` for the cluster. The
135+
``mongodb+srv`` protocol tells the driver to look up the
136+
:manual:`seed List </reference/connection-string/#dns-seed-list-connection-format>`
137+
of hosts in |dns|. |service| synchronizes this list with the
138+
nodes in a cluster. If the connection string uses this URI
139+
format, you don't need to:
140+
141+
- Append the seed list or
142+
- Change the |URI if the nodes change.
143+
144+
You can use this URI format if your driver supports it.
145+
146+
If the command returns errors, see :ref:`Troubleshooting
147+
<mcli-troubleshooting>` for recommended solutions.
148+
149+
.. _mcli-atlas-cluster-cs-describe-egs:
150+
151+
Examples
152+
--------
153+
154+
The following examples use the ``mongocli atlas cluster cs describe``
155+
command to retrieve the standard connection string for a cluster named
156+
``myCluster`` in the default format and |json| format. It uses the
157+
{+default-profile+} to access the project.
158+
159+
.. tabs::
160+
161+
.. tab:: Default
162+
:tabid: default
163+
164+
.. code-block:: text
165+
166+
mongocli atlas cluster cs describe myCluster
167+
168+
The previous command prints the following output to the terminal:
169+
170+
.. code-block:: shell
171+
:copyable: false
172+
173+
STANDARD CONNECTION STRING
174+
mongodb+srv://myCluster.7hgjn.mongodb.net
175+
176+
.. tab:: JSON
177+
:tabid: json
178+
179+
.. code-block:: text
180+
:copyable: false
181+
182+
mongocli atlas cluster cs describe myCluster --output json
183+
184+
The previous command prints the following output to the terminal:
185+
186+
.. code-block:: shell
187+
:copyable: false
188+
189+
{
190+
"standard": "mongodb://myCluster-shard-00-00.7hgjn.mongodb.net:27017,myCluster-shard-00-01.7hgjn.mongodb.net:27017,myCluster-shard-00-02.7hgjn.mongodb.net:27017/?ssl=true\u0026authSource=admin\u0026replicaSet=atlas-y1l294-shard-0",
191+
"standardSrv": "mongodb+srv://myCluster.7hgjn.mongodb.net"
192+
}

0 commit comments

Comments
 (0)