Skip to content

Commit

Permalink
DOCSP-32269 atlas top 250 revamp connection and compat page (#462)
Browse files Browse the repository at this point in the history
* revamped connection and compat page

(cherry picked from commit ed4ba2f)
  • Loading branch information
kyuan-mongodb authored Oct 6, 2023
1 parent 6a730df commit 5dbf738
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
1 change: 1 addition & 0 deletions snooty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"
[constants]
driver = "java"
driver-long = "MongoDB Java Driver"
driver-short = "Java Driver"
version = "4.5"
full-version = "{+version+}.1"
mdb-server = "MongoDB Server"
Expand Down
5 changes: 5 additions & 0 deletions source/compatibility.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Compatibility
:class: singlecol


You can use the {+driver-short+} to connect to deployments hosted in the
following environments:

.. include:: /includes/fact-environments.rst

MongoDB Compatibility
---------------------

Expand Down
36 changes: 22 additions & 14 deletions source/fundamentals/connection/connect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
Connect to MongoDB
==================

In this guide, you can learn how to connect to a MongoDB instance or
replica set using the Java driver.
In this guide, you can learn how to connect to a
`MongoDB Atlas deployment <https://www.mongodb.com/docs/atlas>`__,
a MongoDB instance, or a replica set using the {+driver-short+}.

You can view sample code to :ref:`connect to an Atlas cluster <connect-atlas-java-driver>`
or continue reading to learn more about the ``MongoClient`` class and
Expand Down Expand Up @@ -50,13 +51,15 @@ connect to a MongoDB deployment. It instructs the driver on how it should
connect to MongoDB and how it should behave while connected. The following
figure explains each part of a sample connection URI:

.. figure:: /includes/figures/connection_uri_parts.png
:alt: Connection String parts figure
.. figure:: /includes/figures/dns_seedlist_connection_string_parts.png
:alt: An example of a connection string that demonstrates the protocol, credentials, hostname or IP, port, and connection options

This figure uses the :manual:`Standard Connection String Format </reference/connection-string/#std-label-connections-standard-connection-string-format>`,
``mongodb`` for the protocol. You can also use the :manual:`DNS Seed List Connection Format </reference/connection-string/#dns-seed-list-connection-format>`,
``mongodb+srv``, if you want more flexibility of deployment and the ability
to change the servers in rotation without reconfiguring clients.
In this example, you connect to an Atlas MongoDB deployment that has a
DNS SRV record. For more details, see the :manual:`DNS Seed List
Connection Format
</reference/connection-string/#dns-seed-list-connection-format>`
documentation. This format offers flexibility in deployment and the
ability to change the servers in rotation without reconfiguring clients.

.. note::

Expand All @@ -65,19 +68,24 @@ to change the servers in rotation without reconfiguring clients.
and select Java from the language dropdown to retrieve your connection
string.

The next part of the connection URI contains your credentials if you are
using a password-based authentication mechanism. Replace the value of ``user``
with your username and ``pass`` with your password. If your
authentication mechanism does not require credentials, omit this part of
the connection URI.
If you are connecting to an instance or replica set that does not have a
DNS SRV address, you must use ``mongodb`` for the protocol, which specifies
the :manual:`Standard Connection String Format
</reference/connection-string/#std-label-connections-standard-connection-string-format>`.

After the protocol, the connection string contains your
credentials if you are using a password-based authentication mechanism.
Replace the value of ``user`` with your username and ``pass`` with your
password. If your authentication mechanism does not require credentials,
omit this part of the connection URI.

The next part of the connection URI specifies the hostname or IP
address, followed by the port of your MongoDB instance. In the example,
``sample.host`` represents the hostname and ``27017`` is the port number.
Replace these values to refer to your MongoDB instance.

The last part of the connection URI contains connection options as parameters.
In the example, we set two connection options: ``maxPoolSize=20`` and
In the example, you set two connection options: ``maxPoolSize=20`` and
``w=majority``. For more information on connection options, skip to the
:ref:`connection-options` section of this guide.

Expand Down
Binary file removed source/includes/figures/connection_uri_parts.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5dbf738

Please sign in to comment.