Skip to content

Commit da413db

Browse files
authored
Merge branch 'main' into DOCSP-42297-time-series
2 parents 826f134 + 72c693c commit da413db

29 files changed

+2564
-730
lines changed

snooty.toml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name = "java-rs"
22
title = "Java Reactive Streams Driver"
33

4-
intersphinx = [ "https://www.mongodb.com/docs/manual/objects.inv",
5-
"https://www.mongodb.com/docs/atlas/objects.inv"
6-
]
4+
intersphinx = [
5+
"https://www.mongodb.com/docs/manual/objects.inv",
6+
"https://www.mongodb.com/docs/atlas/objects.inv",
7+
]
78

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

@@ -14,18 +15,22 @@ toc_landing_pages = [
1415
"/getting-started/",
1516
"/secure-your-data/",
1617
"/data-formats/"
18+
"/upgrade/"
1719
]
1820

1921
[constants]
2022
driver-short = "Java Reactive Streams driver"
2123
driver-long = "MongoDB Java Reactive Streams Driver"
2224
version = "5.1"
23-
full-version = "{+version+}.3"
25+
full-version = "{+version+}.4"
2426
api = "https://mongodb.github.io/mongo-java-driver/{+version+}/apidocs"
2527
rs-docs = "https://www.reactive-streams.org/reactive-streams-1.0.4-javadoc/org/reactivestreams"
2628
driver-source-gh = "https://github.com/mongodb/mongo-java-driver"
2729
java-rs = "Java Reactive Streams"
2830
string-data-type = "``String``"
2931
bool = "``boolean``"
3032
pr = "Project Reactor"
31-
mdb-server = "MongoDB Server"
33+
mdb-server = "MongoDB Server"
34+
snappyVersion = "org.xerial.snappy:snappy-java:1.1.10.3"
35+
zstdVersion = "com.github.luben:zstd-jni:1.5.5-3"
36+
stable-api = "Stable API"

source/connect-to-mongo/choose-connection-target.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ Then, pass your connection string to the ``create()`` method constructing a ``Mo
4040
Follow the :atlas:`Atlas driver connection guide </driver-connection>`
4141
to retrieve your connection string.
4242

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

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

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

source/connect-to-mongo/compression.txt

Lines changed: 0 additions & 147 deletions
This file was deleted.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
.. _java-rs-compression:
2+
.. _java-rs-network-compression:
3+
4+
========================
5+
Compress Network Traffic
6+
========================
7+
8+
.. contents:: On this page
9+
:local:
10+
:backlinks: none
11+
:depth: 1
12+
:class: singlecol
13+
14+
.. facet::
15+
:name: genre
16+
:values: reference
17+
18+
.. meta::
19+
:keywords: zlib, zstandard, zstd, snappy
20+
21+
The {+driver-short+} provides a connection option to compress messages, which reduces the amount
22+
of data passed over the network between MongoDB and your application.
23+
24+
The driver supports the following algorithms:
25+
26+
- `Snappy <https://google.github.io/snappy/>`__: available in MongoDB 3.4 and later.
27+
- `Zlib <https://zlib.net/>`__: available in MongoDB 3.6 and later.
28+
- `Zstandard <https://github.com/facebook/zstd/>`__: available in MongoDB 4.2 and later.
29+
30+
The driver tests against the following versions of these libraries:
31+
32+
- ``{+snappyVersion+}``
33+
- ``{+zstdVersion+}``
34+
35+
If you specify multiple compression algorithms, the driver selects the first one
36+
in the list supported by your MongoDB instance.
37+
38+
.. note::
39+
40+
Applications that require Snappy or Zstandard compression must
41+
:ref:`add explicit dependencies <java-rs-compression-dependencies>` for those
42+
algorithms.
43+
44+
.. _enable-compression:
45+
46+
Specify Compression Algorithms
47+
------------------------------
48+
49+
You can enable compression for the connection to your MongoDB instance
50+
by specifying the algorithms in one of two ways. Select the
51+
:guilabel:`Connection String` or :guilabel:`MongoClientSettings` tab to
52+
see the corresponding syntax:
53+
54+
- In the ``compressors`` parameter of your connection string
55+
- In the ``compressorList`` method chained to the ``MongoClientSettings.builder()`` method
56+
57+
The following example shows how to specify all compression algorithms:
58+
59+
.. tabs::
60+
61+
.. tab:: Connection String
62+
:tabid: connectionstring
63+
64+
.. literalinclude:: /includes/connect/network-compression.java
65+
:start-after: start-specify-connection-string
66+
:end-before: end-specify-connection-string
67+
:language: java
68+
69+
.. tab:: MongoClientSettings
70+
:tabid: mongoclientsettings
71+
72+
.. literalinclude:: /includes/connect/network-compression.java
73+
:start-after: start-specify-uri
74+
:end-before: end-specify-uri
75+
:language: java
76+
77+
.. _java-rs-compression-dependencies:
78+
79+
Compression Algorithm Dependencies
80+
----------------------------------
81+
82+
The JDK natively supports `Zlib <https://zlib.net/>`__ compression. However,
83+
Snappy and Zstandard depend on open source Java implementations. To learn more
84+
about these implementations, see the following Github pages:
85+
86+
- `snappy-java <https://github.com/xerial/snappy-java>`__
87+
- `zstd-java <https://github.com/luben/zstd-jni>`__
88+
89+
API Documentation
90+
-----------------
91+
92+
To learn more about any of the methods or types discussed in this
93+
guide, see the following API documentation:
94+
95+
- `MongoClient <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoClient.html>`__
96+
- `createSnappyCompressor() <{+api+}/mongodb-driver-core/com/mongodb/MongoCompressor.html#createSnappyCompressor()>`__
97+
- `createZlibCompressor() <{+api+}//mongodb-driver-core/com/mongodb/MongoCompressor.html#createZlibCompressor()>`__
98+
- `createZstdCompressor() <{+api+}/mongodb-driver-core/com/mongodb/MongoCompressor.html#createZstdCompressor()>`__

0 commit comments

Comments
 (0)