@@ -13,3 +13,162 @@ Connect to Your MongoDB Deployment
13
13
:class: singlecol
14
14
15
15
.. include:: /includes/fact-vsce-preview.rst
16
+
17
+ This page outlines how to use |vcse| to connect to a
18
+ MongoDB host. You can connect to a standalone, replica set,
19
+ or sharded cluster host.
20
+
21
+ .. admonition:: MongoDB Atlas
22
+ :class: note
23
+
24
+ If you need to create a MongoDB host, consider using
25
+ `MongoDB Atlas <https://www.mongodb.com/cloud/atlas?tck=docs_vsce>`__.
26
+ Atlas is a cloud-hosted database-as-a-service which requires no
27
+ installation, offers a free tier to get started, and provides a
28
+ copyable URI to easily connect |vsce| to your deployment.
29
+
30
+ If you need to install |vsce|, see :ref:`vsce-install` for instructions.
31
+
32
+ Considerations
33
+ --------------
34
+
35
+ - When connecting |vsce| to a replica set, use either the
36
+ replica set :guilabel:`SRV record` or :guilabel:`Replica Set Name`
37
+ when filling in your connection information. It is not recommended to
38
+ connect directly to an individual replica set member.
39
+
40
+ - If the member to which you are connected switches from a
41
+ :manual:`primary </core/replica-set-primary/>` member to a
42
+ :manual:`secondary </core/replica-set-secondary/>` or vice versa as
43
+ the result of an election, |vsce| may either forcibly close
44
+ the connection or display stale data.
45
+
46
+ - You can't connect |vsce| directly to an :atlas:`analytics node
47
+ <faq/#what-are-analytics-nodes>`.
48
+
49
+ - |vsce| appends the ``appName`` connection string option with a value
50
+ of ``mongodb-vscode <version>`` for all deployment connections.
51
+
52
+ .. - If you are using Kerberos as your authentication mechanism, do not
53
+ .. specify the :guilabel:`Password` in the connection form.
54
+
55
+ .. _vsce-connect-task:
56
+
57
+ Create a Connection to a Deployment
58
+ -----------------------------------
59
+
60
+ |vsce| provides two methods to create a connection to a deployment. You
61
+ can:
62
+
63
+ - Provide a deployment connection string, or
64
+ - Fill in a deployment information in specific fields.
65
+
66
+ Providing a connection string is faster and easier than filling in a
67
+ deployment's details. Use this option if |service| hosts your
68
+ deployment or if you have a connection string for a deployment
69
+ available.
70
+
71
+ Define how your connection is saved with the
72
+ :guilabel:`Default Connection Saving Location`
73
+ :ref:`setting <vsce-settings>`:
74
+
75
+ .. list-table::
76
+ :header-rows: 1
77
+ :widths: 20 40
78
+
79
+ * - Setting
80
+ - Description
81
+
82
+ * - ``Global``
83
+ - Save your connection globally in VS Code, so it can be accessed
84
+ from any workspace.
85
+
86
+ * - ``Workspace``
87
+ - Save your connection in your workspace. You cannot
88
+ access the connection from a different workspace.
89
+
90
+ * - ``Session``
91
+ - Save the connection for only this VS Code session. The connection
92
+ is lost when you close VS Code.
93
+
94
+ .. tabs::
95
+
96
+ .. tab:: Paste Connection String
97
+ :tabid: paste-connection-string
98
+
99
+ When you provide a connection string, |vsce| supports
100
+ most :manual:`Connection String Options
101
+ </reference/connection-string/#connection-string-options>`
102
+ supported by MongoDB.
103
+
104
+ .. include:: /includes/steps/starting-vsce-paste-string.rst
105
+
106
+ .. tab:: Fill in Individual Fields
107
+ :tabid: individual-fields
108
+
109
+ .. include:: /includes/steps/starting-vsce-individual-fields.rst
110
+
111
+ .. _vsce-activate-connection:
112
+
113
+ Activate a Connection
114
+ ---------------------
115
+
116
+ You can connect |vsce| to only one deployment at a time. To change the
117
+ active connection to a different deployment, or to connect to a
118
+ deployment from which you were disconnected:
119
+
120
+ .. include:: /includes/steps/activate-connection.rst
121
+
122
+ .. _vsce-disconnect-task:
123
+
124
+ Disconnect from a Deployment
125
+ ----------------------------
126
+
127
+ |vsce| provides two methods to disconnect from a deployment. You can:
128
+
129
+ - Disconnect with the Command Palette, or
130
+ - Disconnect from the :guilabel:`MongoDB` view in the
131
+ :guilabel:`Activity Bar`.
132
+
133
+ .. tabs::
134
+
135
+ .. tab:: Disconnect with the Command Palette
136
+ :tabid: command-palette
137
+
138
+ .. include:: /includes/steps/disconnect-command-palette.rst
139
+
140
+ .. tab:: Disconnect from the MongoDB View
141
+ :tabid: mdb-view
142
+
143
+ .. include:: /includes/steps/disconnect-mongodb-view.rst
144
+
145
+ Disconnecting from a MongoDB instance closes the |vsce| connection to
146
+ the active instance. You must :ref:`reconnect <vsce-connect-task>` to
147
+ interact with data in your deployment again.
148
+
149
+ Remove a Connection
150
+ -------------------
151
+
152
+ |vsce| provides two methods to remove a connection to a deployment from
153
+ |vscode-short|. You can:
154
+
155
+ - Remove a connection with the Command Palette, or
156
+ - Remove a connection from the :guilabel:`MongoDB` view in the
157
+ :guilabel:`Activity Bar`.
158
+
159
+ .. important::
160
+
161
+ Removing a connection from |vscode-short| removes it both from the
162
+ current workspace and from |vscode-short| globally.
163
+
164
+ .. tabs::
165
+
166
+ .. tab:: Remove Connection with the Command Palette
167
+ :tabid: command-palette
168
+
169
+ .. include:: /includes/steps/remove-connection-command-palette.rst
170
+
171
+ .. tab:: Remove Connection from the MongoDB View
172
+ :tabid: mdb-view
173
+
174
+ .. include:: /includes/steps/remove-connection-mdb-view.rst
0 commit comments