Skip to content

Commit e19b454

Browse files
DOCSP-25682): Import favorite connections (#432)
* (DOCSP-25219): Import and export favorite connections with the CLI * fix snooty.toml * (DOCSP-25219): Export favorite connections with the CLI * update snooty.toml * typo * WIP * edits * more edits * edits * comma splice * updates per Dave's review * edits * edits * wording * wording * tweak admonition * edits * (DOCSP-25682): Import favorite connections * wording * edits * wording * simplify * updates per review suggestions * edits * remove extra include
1 parent 52ca527 commit e19b454

File tree

2 files changed

+156
-6
lines changed

2 files changed

+156
-6
lines changed

source/connect/favorite-connections/import-export-cli/export.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ information, you may encrypt the exported file with a passphrase.
3131
Export Encrypted Favorite Connections
3232
-------------------------------------
3333

34-
This section explains to export encrypted favorite connections. When you
35-
encrypt the export file, users must specify the matching passphrase to
36-
import the connections.
34+
This section shows how to export encrypted favorite connections. When
35+
you encrypt the export file, users must specify the matching passphrase
36+
to import the connections.
3737

3838
Procedure
3939
~~~~~~~~~
@@ -142,8 +142,8 @@ Sensitive connection information is encrypted in the
142142
Export Unencrypted Favorite Connections
143143
---------------------------------------
144144

145-
This section explains to export unencrypted favorite connections. If you
146-
do not encrypt the export file, database usernames and passwords are
145+
This section shows how to export unencrypted favorite connections. If
146+
you do not encrypt the export file, database usernames and passwords are
147147
exported in plaintext. Only export unencrypted connections if no other
148148
users will have access to the exported file.
149149

source/connect/favorite-connections/import-export-cli/import.txt

Lines changed: 151 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,154 @@ Import Favorite Connections with the CLI
1212
:depth: 2
1313
:class: singlecol
1414

15-
TODO: Write
15+
You can use the |compass-short| :abbr:`CLI (Command-Line Interface)` to
16+
import favorite connections. This lets you use saved connections from
17+
other workspaces or connections used by other team members.
18+
19+
Prerequisite
20+
------------
21+
22+
To import favorite connections, you must first :ref:`export the
23+
connections <compass-export-connections-cli>`.
24+
25+
Import Encrypted Favorite Connections
26+
-------------------------------------
27+
28+
Use this procedure to import a list of favorite connections that is
29+
:ref:`encrypted with a passphrase
30+
<compass-export-connections-cli-encrypted>`.
31+
32+
Procedure
33+
~~~~~~~~~
34+
35+
To import unencrypted favorite connections with the |compass-short|
36+
:abbr:`CLI (Command-Line Interface)`, specify:
37+
38+
- The path to the |compass| executable. The name and filepath of the
39+
executable depend on your operating system.
40+
41+
- The ``--import-connections`` option set to the destination of the file
42+
containing favorite connections.
43+
44+
- The ``--passphrase`` option set to the passphrase used to encrypt the
45+
exported file.
46+
47+
Your operation should resemble the following prototype:
48+
49+
.. code-block:: sh
50+
51+
<path-to-Compass-executable> \
52+
--import-connections=<filename> \
53+
--passphrase=<passphrase>
54+
55+
Example
56+
~~~~~~~
57+
58+
The following example imports favorite |compass-short| connections from
59+
a file with the path
60+
``/tmp/compass-connections/favorites-encrypted.json`` that is encrypted
61+
with the passphrase ``abc123``.
62+
63+
Run the following command in the folder containing your MongoDB Compass
64+
executable:
65+
66+
.. code-block:: sh
67+
68+
./MongoDB\ Compass \
69+
--import-connections=/tmp/compass-connections/favorites-encrypted.json \
70+
--passphrase=abc123
71+
72+
.. note::
73+
74+
The name and file path of the executable depend on your operating
75+
system. The preceding command is for macOS.
76+
77+
Results
78+
```````
79+
80+
After you run the import command, you will see this output:
81+
82+
.. code-block:: sh
83+
:copyable: false
84+
85+
Importing connections from "/tmp/compass-connections/favorites-encrypted.json" (with passphrase)
86+
87+
MongoDB Compass starts and you will see the imported connections under
88+
:guilabel:`Saved Connections` on the Connect screen.
89+
90+
Errors
91+
~~~~~~
92+
93+
When you try to import encrypted favorite connections, you may
94+
see these errors:
95+
96+
- If do not specify a passphrase, you will see this error:
97+
98+
.. code-block:: sh
99+
:copyable: false
100+
101+
Failed to perform operation Be [Error]: Input file contains encrypted
102+
secrets but no passphrase was provided
103+
104+
- If you specify an incorrect passphrase, you will see this error:
105+
106+
.. code-block:: sh
107+
:copyable: false
108+
109+
Failed to perform operation Be [Error]: Cannot decrypt due to corrupt
110+
data or wrong passphrase
111+
112+
Import Unencrypted Favorite Connections
113+
---------------------------------------
114+
115+
Use this procedure to import a list of favorite connections that is not
116+
encrypted with a passphrase.
117+
118+
Procedure
119+
~~~~~~~~~
120+
121+
To import unencrypted favorite connections with the |compass-short|
122+
:abbr:`CLI (Command-Line Interface)`, specify:
123+
124+
- The path to the |compass| executable. The name and file path of the
125+
executable depend on your operating system.
126+
127+
- The ``--import-connections`` option set to the destination of the file
128+
containing favorite connections.
129+
130+
Your operation should resemble the following prototype:
131+
132+
.. code-block:: sh
133+
134+
<path-to-Compass-executable> --import-connections=<filename>
135+
136+
Example
137+
~~~~~~~
138+
139+
The following example imports favorite |compass-short| connections from
140+
a file with the path ``/tmp/compass-connections/favorites.json``.
141+
142+
Run the following command in the folder containing your MongoDB Compass
143+
executable:
144+
145+
.. code-block:: sh
146+
147+
./MongoDB\ Compass --import-connections=/tmp/compass-connections/favorites.json
148+
149+
.. note::
150+
151+
The name and file path of the executable depend on your operating
152+
system. The preceding command is for macOS.
153+
154+
Results
155+
```````
156+
157+
After you run the import command, you will see this output:
158+
159+
.. code-block:: sh
160+
:copyable: false
161+
162+
Importing connections from "/tmp/compass-connections/favorites.json" (without passphrase)
163+
164+
MongoDB Compass starts and you will see the imported connections under
165+
:guilabel:`Saved Connections` on the Connect screen.

0 commit comments

Comments
 (0)