@@ -104,24 +104,24 @@ To specify your connection URI, pass it to the ``ApplyURI()`` method, which
104
104
returns a new ``ClientOptions`` instance. To set any other options, call the
105
105
relevant helper method from the options package.
106
106
107
- To learn more about connection options, see the :ref:`Connection Options section
108
- <golang-connection-options>`. To learn more about creating a client, see the API
109
- documentation for `Client <{+api+}/mongo#Client>`__ and `Connect()
107
+ To learn more about connection options, see the :ref:`Connection Options
108
+ <golang-connection-options>` section . To learn more about creating a client, see
109
+ the API documentation for `Client <{+api+}/mongo#Client>`__ and `Connect()
110
110
<{+api+}/mongo#Connect>`__.
111
111
112
112
You can set the {+stable-api+} version as an option to avoid breaking changes
113
113
when you upgrade to a new server version. To learn more about the {+stable-api+}
114
114
feature, see the :ref:`{+stable-api+} page <golang-stable-api>`.
115
115
116
+ .. _go-connection-example-code:
117
+
116
118
Example
117
119
~~~~~~~
118
120
119
121
The following code shows how you can create a client that uses an Atlas
120
122
connection string and the {+stable-api+} version, connect to MongoDB, and verify
121
123
that the connection is successful:
122
124
123
- .. _go-connection-example-code:
124
-
125
125
.. literalinclude:: /includes/fundamentals/code-snippets/srv.go
126
126
:language: go
127
127
:copyable:
@@ -143,16 +143,16 @@ Other Ways to Connect to MongoDB
143
143
--------------------------------
144
144
145
145
If you are connecting to a single MongoDB server instance or replica set
146
- that is not hosted on Atlas, see the following sections to find out how to
146
+ that is not hosted on Atlas, see the following sections to learn how to
147
147
connect.
148
148
149
149
Connect to a MongoDB Server on Your Local Machine
150
150
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151
151
152
152
.. include:: /includes/localhost-connection.rst
153
153
154
- To test whether you can connect to your server, replace the connection
155
- string with your localhost connection string in the preceding code example.
154
+ To test whether you can connect to your server, replace the connection string
155
+ with your localhost connection string in the preceding ` code example <go-connection-example-code>` .
156
156
157
157
Connect to a Replica Set
158
158
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -183,7 +183,7 @@ When connecting to a replica set, the driver takes the following actions by defa
183
183
However, to ensure connectivity when the specified host
184
184
is unavailable, you must provide the full list of hosts.
185
185
186
- To learn more about replication in MongoDB, see the :manual:`Replication </replication>` section of server manual.
186
+ To learn more about replication in MongoDB, see the :manual:`Replication </replication>` section of Server manual.
187
187
188
188
Direct Connection
189
189
`````````````````
0 commit comments