diff --git a/snooty.toml b/snooty.toml index 5257a2657..9a45491b9 100644 --- a/snooty.toml +++ b/snooty.toml @@ -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" diff --git a/source/compatibility.txt b/source/compatibility.txt index e212280ce..9dab59d52 100644 --- a/source/compatibility.txt +++ b/source/compatibility.txt @@ -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 --------------------- diff --git a/source/fundamentals/connection/connect.txt b/source/fundamentals/connection/connect.txt index 8c93ec2f6..b7119b5b0 100644 --- a/source/fundamentals/connection/connect.txt +++ b/source/fundamentals/connection/connect.txt @@ -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 `__, +a MongoDB instance, or a replica set using the {+driver-short+}. You can view sample code to :ref:`connect to an Atlas cluster ` or continue reading to learn more about the ``MongoClient`` class and @@ -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 `, -``mongodb`` for the protocol. You can also use the :manual:`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 +` +documentation. This format offers flexibility in deployment and the +ability to change the servers in rotation without reconfiguring clients. .. note:: @@ -65,11 +68,16 @@ 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 +`. + +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, @@ -77,7 +85,7 @@ address, followed by the port of your MongoDB instance. In the example, 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. diff --git a/source/includes/figures/connection_uri_parts.png b/source/includes/figures/connection_uri_parts.png deleted file mode 100644 index 0d10bcfc4..000000000 Binary files a/source/includes/figures/connection_uri_parts.png and /dev/null differ diff --git a/source/includes/figures/dns_seedlist_connection_string_parts.png b/source/includes/figures/dns_seedlist_connection_string_parts.png new file mode 100644 index 000000000..d57165511 Binary files /dev/null and b/source/includes/figures/dns_seedlist_connection_string_parts.png differ