Skip to content

Commit

Permalink
Merge branch 'main' into DOCSP-42299-replica-sets
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-smith721 authored Sep 10, 2024
2 parents 851fb63 + 2a6232a commit 724ef50
Show file tree
Hide file tree
Showing 25 changed files with 2,211 additions and 549 deletions.
18 changes: 12 additions & 6 deletions snooty.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name = "java-rs"
title = "Java Reactive Streams Driver"

intersphinx = [ "https://www.mongodb.com/docs/manual/objects.inv",
"https://www.mongodb.com/docs/atlas/objects.inv"
]
intersphinx = [
"https://www.mongodb.com/docs/manual/objects.inv",
"https://www.mongodb.com/docs/atlas/objects.inv",
]

sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"

Expand All @@ -12,19 +13,24 @@ toc_landing_pages = [
"/read-data-from-mongo/",
"/write-data-to-mongo/",
"/getting-started/",
"/secure-your-data/"
"/secure-your-data/",
"/data-formats/",
"/upgrade/"
]

[constants]
driver-short = "Java Reactive Streams driver"
driver-long = "MongoDB Java Reactive Streams Driver"
version = "5.1"
full-version = "{+version+}.3"
full-version = "{+version+}.4"
api = "https://mongodb.github.io/mongo-java-driver/{+version+}/apidocs"
rs-docs = "https://www.reactive-streams.org/reactive-streams-1.0.4-javadoc/org/reactivestreams"
driver-source-gh = "https://github.com/mongodb/mongo-java-driver"
java-rs = "Java Reactive Streams"
string-data-type = "``String``"
bool = "``boolean``"
pr = "Project Reactor"
mdb-server = "MongoDB Server"
mdb-server = "MongoDB Server"
snappyVersion = "org.xerial.snappy:snappy-java:1.1.10.3"
zstdVersion = "com.github.luben:zstd-jni:1.5.5-3"
stable-api = "Stable API"
6 changes: 3 additions & 3 deletions source/connect-to-mongo/choose-connection-target.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ Then, pass your connection string to the ``create()`` method constructing a ``Mo
Follow the :atlas:`Atlas driver connection guide </driver-connection>`
to retrieve your connection string.

When you connect to Atlas, we recommend using the Stable API client option to avoid
When you connect to Atlas, we recommend using the {+stable-api+} client option to avoid
breaking changes when Atlas upgrades to a new version of MongoDB Server.
To learn more about the Stable API feature, see :manual:`Stable API
To learn more about the {+stable-api+} feature, see :manual:`Stable API
</reference/stable-api>` in the MongoDB Server manual.

The following code shows how to use the {+driver-short+} to connect to an Atlas cluster. The
code uses the ``serverApi`` option to specify a Stable API version.
code uses the ``serverApi`` option to specify a {+stable-api+} version.

.. include:: /includes/connect/connect-reactor.rst

Expand Down
147 changes: 0 additions & 147 deletions source/connect-to-mongo/compression.txt

This file was deleted.

98 changes: 98 additions & 0 deletions source/connect-to-mongo/network-compression.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
.. _java-rs-compression:
.. _java-rs-network-compression:

========================
Compress Network Traffic
========================

.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol

.. facet::
:name: genre
:values: reference

.. meta::
:keywords: zlib, zstandard, zstd, snappy

The {+driver-short+} provides a connection option to compress messages, which reduces the amount
of data passed over the network between MongoDB and your application.

The driver supports the following algorithms:

- `Snappy <https://google.github.io/snappy/>`__: available in MongoDB 3.4 and later.
- `Zlib <https://zlib.net/>`__: available in MongoDB 3.6 and later.
- `Zstandard <https://github.com/facebook/zstd/>`__: available in MongoDB 4.2 and later.

The driver tests against the following versions of these libraries:

- ``{+snappyVersion+}``
- ``{+zstdVersion+}``

If you specify multiple compression algorithms, the driver selects the first one
in the list supported by your MongoDB instance.

.. note::

Applications that require Snappy or Zstandard compression must
:ref:`add explicit dependencies <java-rs-compression-dependencies>` for those
algorithms.

.. _enable-compression:

Specify Compression Algorithms
------------------------------

You can enable compression for the connection to your MongoDB instance
by specifying the algorithms in one of two ways. Select the
:guilabel:`Connection String` or :guilabel:`MongoClientSettings` tab to
see the corresponding syntax:

- In the ``compressors`` parameter of your connection string
- In the ``compressorList`` method chained to the ``MongoClientSettings.builder()`` method

The following example shows how to specify all compression algorithms:

.. tabs::

.. tab:: Connection String
:tabid: connectionstring

.. literalinclude:: /includes/connect/network-compression.java
:start-after: start-specify-connection-string
:end-before: end-specify-connection-string
:language: java

.. tab:: MongoClientSettings
:tabid: mongoclientsettings

.. literalinclude:: /includes/connect/network-compression.java
:start-after: start-specify-uri
:end-before: end-specify-uri
:language: java

.. _java-rs-compression-dependencies:

Compression Algorithm Dependencies
----------------------------------

The JDK natively supports `Zlib <https://zlib.net/>`__ compression. However,
Snappy and Zstandard depend on open source Java implementations. To learn more
about these implementations, see the following Github pages:

- `snappy-java <https://github.com/xerial/snappy-java>`__
- `zstd-java <https://github.com/luben/zstd-jni>`__

API Documentation
-----------------

To learn more about any of the methods or types discussed in this
guide, see the following API documentation:

- `MongoClient <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoClient.html>`__
- `createSnappyCompressor() <{+api+}/mongodb-driver-core/com/mongodb/MongoCompressor.html#createSnappyCompressor()>`__
- `createZlibCompressor() <{+api+}//mongodb-driver-core/com/mongodb/MongoCompressor.html#createZlibCompressor()>`__
- `createZstdCompressor() <{+api+}/mongodb-driver-core/com/mongodb/MongoCompressor.html#createZstdCompressor()>`__
Loading

0 comments on commit 724ef50

Please sign in to comment.