File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ Learn how to use the {+driver-short+} to configure your application's
28
28
connection to a MongoDB deployment in the following sections:
29
29
30
30
- :ref:`golang-connection-guide`
31
+ - :ref:`golang-connection-targets`
31
32
- :ref:`golang-connection-options`
32
33
- :ref:`golang-network-compression`
33
34
- :ref:`golang-tls`
Original file line number Diff line number Diff line change
1
+ .. _golang-connection-targets:
2
+
3
+ ==========================
4
+ Choose a Connection Target
5
+ ==========================
6
+
7
+ Overview
8
+ --------
9
+
10
+ In this guide, you can learn how to use a connection string and a
11
+ ``MongoClient`` object to connect to different types of MongoDB deployments.
12
+
13
+ .. tip::
14
+
15
+ To learn more about how to retrieve or format your connection string, see
16
+ the :ref:`Connection URI <connection-guide>` guide in
17
+ the Go Connection Guide.
18
+
19
+ Atlas
20
+ -----
21
+
22
+ To connect to a MongoDB deployment on Atlas, include the following elements in your
23
+ connection string:
24
+
25
+ - URL of your Atlas cluster
26
+ - MongoDB username
27
+ - MongoDB password
28
+
29
+ Then, pass your connection string to the ``MongoClient`` constructor.
30
+
31
+ When you connect to Atlas, we recommend using the {+stable-api+} client option to avoid
32
+ breaking changes when Atlas upgrades to a new version of {+mdb-server+}.
33
+ To learn more about the {+stable-api+} feature, see the :ref:`<stable-api>`
34
+ guide.
35
+
36
+ The following code shows how to use the {+driver-short+} to connect to an Atlas cluster. The
37
+ code also uses the ``server_api`` field to specify a {+stable-api+} version.
38
+
39
+ .. _go-connection-example-code:
40
+
You can’t perform that action at this time.
0 commit comments