@@ -19,10 +19,13 @@ deployment using the Go Driver.
1919Connection URI
2020--------------
2121
22- The **connection URI** provides a set of instructions that the driver uses to
23- connect to a MongoDB deployment. It instructs the driver on how it should
24- connect to MongoDB and how it should behave while connected. The following
25- example explains each part of a sample connection URI:
22+ A **connection URI**, also known as a connection string, tells the
23+ driver how to connect to MongoDB and how to behave while connected.
24+
25+ Parts of a Connection URI
26+ ~~~~~~~~~~~~~~~~~~~~~~~~~
27+
28+ The following example explains each part of a sample connection URI:
2629
2730.. figure:: /includes/figures/connection_uri_parts.png
2831 :alt: Each part of the connection string
@@ -55,10 +58,31 @@ options. In the example, we set two connection options:
5558``maxPoolSize=20`` and ``w=majority``. To learn more about connection
5659options, read the :ref:`golang-connection-options` section of this guide.
5760
58- The following code shows how you can use a connection string in a
59- client to connect to MongoDB. In this example, the client uses
60- the :ref:`Stable API <golang-stable-api>` feature, though
61- you can connect to MongoDB without this feature.
61+ Connection Example
62+ ~~~~~~~~~~~~~~~~~~
63+
64+ To connect to MongoDB, you need to create a client. A client manages
65+ your connections and runs database commands.
66+
67+ You can create a client that uses your connection string and other
68+ client options by passing a ``ClientOptions`` object to the ``Connect()``
69+ method. To specify your connection URI, pass it to the ``ApplyURI()``
70+ method, creating a ``ClientOptions`` instance. To set any other
71+ options, call the relevant helper method from the ``options`` package.
72+
73+ To learn more about connection options, see the
74+ :ref:`Connection Options section <golang-connection-options>`. To learn
75+ more about creating a client, see the API documentation for `Client
76+ <{+api+}/mongo#Client>`__ and `Connect() <{+api+}/mongo#Connect>`__.
77+
78+ You can set the {+stable-api+} version as an option to avoid
79+ breaking changes when you upgrade to a new server version. To
80+ learn more about the {+stable-api+} feature, see the :ref:`{+stable-api+} page
81+ <golang-stable-api>`.
82+
83+ The following code shows how you can create a client that uses your
84+ connection string and the {+stable-api+} version, connect to MongoDB, and
85+ verify that the connection is successful:
6286
6387.. literalinclude:: /includes/fundamentals/code-snippets/srv.go
6488 :language: go
0 commit comments