Skip to content

Commit 1cd611d

Browse files
author
Chris Cho
authored
DOCSP-33228 - v4.11 updates (#444)
* v4.11 updates
1 parent 5ad7a89 commit 1cd611d

File tree

6 files changed

+146
-48
lines changed

6 files changed

+146
-48
lines changed

snooty.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ api = "https://mongodb.github.io/mongo-java-driver/{+version+}"
2727
stable-api = "Stable API"
2828
mongocrypt-version = "1.7.3"
2929
nettyVersion = "io.netty:netty-all:4.1.87.Final"
30-
snappyVersion = "org.xerial.snappy:snappy-java:1.1.10.1"
31-
zstdVersion = "com.github.luben:zstd-jni:1.5.2-3"
30+
snappyVersion = "org.xerial.snappy:snappy-java:1.1.10.3"
31+
zstdVersion = "com.github.luben:zstd-jni:1.5.5-3"
3232
logbackVersion = "1.2.11"
3333
log4j2Version = "2.17.1"

source/fundamentals/builders/aggregates.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,8 @@ aggregation stage:
975975
Learn more about this helper from the
976976
`searchMeta() API documentation <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/Aggregates.html#searchMeta(com.mongodb.client.model.search.SearchCollector)>`__.
977977

978+
.. _java-atlas-vector-search:
979+
978980
Atlas Vector Search
979981
-------------------
980982

source/fundamentals/connection/socks.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,4 @@ following API documentation:
130130
- `MongoClientSettings.Builder <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.Builder.html>`__
131131
- `SocketSettings.Builder <{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/SocketSettings.Builder.html>`__
132132
- `MongoClients.create() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoClients.html#create(com.mongodb.MongoClientSettings)>`__
133-
134-
.. TODO
135-
- provide the link for the proxysettings builder once the API docs are generated:
136-
- `ProxySettings.Builder <{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/ProxySettings.Builder.html>`__
133+
- `ProxySettings.Builder <{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/ProxySettings.Builder.html>`__

source/fundamentals/crud/read-operations/change-streams.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ An update operation on the collection produces the following output:
137137
...
138138
}
139139

140+
.. _java-split-change-stream-events:
141+
140142
Split Large Change Stream Events
141143
--------------------------------
142144

@@ -339,4 +341,4 @@ output:
339341
}
340342

341343
For a list of options, see the `FullDocument <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/changestream/FullDocument.html>`__
342-
API documentation.
344+
API documentation.

source/index.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ MongoDB Java Driver
66
:name: programming_language
77
:values: java
88

9-
109
.. facet::
1110
:name: genre
12-
:values: reference
11+
:values: reference
1312

14-
.. meta::
13+
.. meta::
1514
:keywords: java sync
1615

1716
.. toctree::
@@ -191,4 +190,4 @@ Take the free online course taught by MongoDB instructors
191190

192191
- `Using MongoDB with Java <https://learn.mongodb.com/learning-paths/using-mongodb-with-java>`_
193192

194-
Learn the essentials of Java application development with MongoDB.
193+
Learn the essentials of Java application development with MongoDB.

source/whats-new.txt

Lines changed: 135 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -34,67 +34,165 @@ Upcoming Breaking Changes
3434

3535
.. Relocate these items into the source/upgrade.txt page once they become breaking changes
3636

37-
The following changes affect future versions of the driver:
37+
In addition to the deprecations mentioned in specific driver versions on this
38+
page, anticipated breaking changes include the following:
3839

39-
- The ``getStats()`` and ``isCapped()`` instance methods of the
40-
``DBCollection`` class are deprecated in v4.11. The corresponding server
41-
commands are deprecated in MongoDB v6.2 and later. Use the ``$collStats`` aggregation
42-
pipeline stage to retrieve the information provided by these methods
43-
instead. You can run the aggregation as shown in the following code example:
40+
- Beginning with v5.0, the {+driver-short+} requires Java 11 or later.
4441

45-
.. code-block:: java
42+
.. _version-4.11:
4643

47-
collection.aggregate(Arrays.asList(
48-
new Document("$collStats",
49-
new Document("storageStats", new Document()))));
44+
What's New in 4.11
45+
------------------
5046

51-
To determine whether the collection is a capped collection, access the value
52-
of the ``storageStats.capped`` field returned by this example aggregation.
47+
This section includes the following information:
5348

54-
To learn more about the ``$collStats`` aggregation operator, see the
55-
:manual:`$collStats (aggregation) </reference/operator/aggregation/collStats/>`
56-
Server manual entry.
49+
- :ref:`java-deprecations-4.11`
50+
- :ref:`java-new-features-4.11`
5751

58-
- `MapReduceIterable <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MapReduceIterable.html>`__
59-
and map-reduce methods on `MongoCollection <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#mapReduce(com.mongodb.client.ClientSession,java.lang.String,java.lang.String)>`__
60-
are deprecated in MongoDB v4.2 and later. They will be replaced by the
61-
aggregation framework and removed in a future release.
62-
- Beginning with v5.0, the {+driver-short+} will require Java 11 or later.
52+
.. _java-deprecations-4.11:
6353

64-
.. _version-4.11:
54+
Deprecations in 4.11
55+
~~~~~~~~~~~~~~~~~~~~
6556

66-
What's New in 4.11
67-
------------------
57+
.. warning:: Deprecations in this release
6858

69-
.. note:: Upgraded Netty Version
59+
To avoid breaking changes in future major releases of the driver,
60+
replace any application code that depends on deprecated methods and types.
7061

71-
The {+driver-short+} now tests with version 4.1.87.Final of the
72-
``io.netty:netty-all`` package. This change affects you only if you use the
73-
``SslContext`` class that Netty provides.
62+
The 4.11 driver release deprecates the following items:
7463

75-
.. New features of the 4.11 driver release include:
64+
- The ``getStats()`` and ``isCapped()`` instance methods of the
65+
``DBCollection`` class are deprecated. The corresponding server
66+
commands are deprecated in MongoDB v6.2 and later. Use the ``$collStats``
67+
aggregation pipeline stage to retrieve the information provided by these
68+
methods instead. You can run the aggregation as shown in the following code
69+
example:
70+
71+
.. code-block:: java
72+
73+
Cursor cursor = collection.aggregate(Arrays.asList(
74+
new BasicDBObject("$collStats",
75+
new BasicDBObject("storageStats", new BasicDBObject()))),
76+
AggregationOptions.builder().build()
77+
);
78+
79+
To determine whether a collection is a capped collection, access the value
80+
of the ``storageStats.capped`` field returned by ``Cursor`` instance in the
81+
preceding example aggregation.
82+
83+
To learn more about the ``$collStats`` aggregation operator, see the
84+
:manual:`$collStats (aggregation) </reference/operator/aggregation/collStats/>`
85+
Server manual entry.
7686

7787
- The following network address-related methods are deprecated and will be removed
7888
in v5.0:
7989

8090
- The `ServerAddress <{+api+}/apidocs/mongodb-driver-core/com/mongodb/ServerAddress.html>`__
8191
methods ``getSocketAddress()`` and ``getSocketAddresses()``.
82-
92+
8393
Instead of ``getSocketAddress()``, use the ``getByName()`` instance
8494
method of ``java.net.InetAddress``.
85-
95+
8696
Instead of ``getSocketAddresses()``, use the ``getAllByName()`` instance
8797
method of ``java.net.InetAddress``.
8898

8999
- The `UnixServerAddress <{+api+}/apidocs/mongodb-driver-core/com/mongodb/UnixServerAddress.html>`__
90100
method ``getUnixSocketAddress()``.
91-
101+
92102
Instead of ``getUnixSocketAddress()``, construct an instance of
93103
``jnr.unixsocket.UnixSocketAddress``. Pass the full path of the UNIX
94104
socket file to the constructor. By default, MongoDB creates a UNIX
95105
socket file located at ``"/tmp/mongodb-27017.sock"``. To learn more
96-
about the ``UnixSocketAddress``, see the `UnixSocketAddress API documentation
97-
<https://www.javadoc.io/doc/com.github.jnr/jnr-unixsocket/latest/jnr/unixsocket/UnixSocketAddress.html>`__.
106+
about the ``UnixSocketAddress``, see the `UnixSocketAddress <https://www.javadoc.io/doc/com.github.jnr/jnr-unixsocket/latest/jnr/unixsocket/UnixSocketAddress.html>`__ API documentation.
107+
108+
- The following methods and types related to the
109+
`StreamFactory <https://mongodb.github.io/mongo-java-driver/4.10/apidocs/mongodb-driver-core/com/mongodb/connection/StreamFactory.html>`__
110+
interface are deprecated and scheduled for removal in v5.0:
111+
112+
- ``streamFactoryFactory()`` method from ``MongoClientSettings.Builder``
113+
- ``getStreamFactoryFactory()`` method from ``MongoClientSettings``
114+
- ``NettyStreamFactoryFactory`` class
115+
- ``NettyStreamFactory`` class
116+
- ``AsynchronousSocketChannelStreamFactory`` class
117+
- ``AsynchronousSocketChannelStreamFactoryFactory`` class
118+
- ``BufferProvider`` class
119+
- ``SocketStreamFactory`` class
120+
- ``Stream`` class
121+
- ``StreamFactory`` class
122+
- ``StreamFactoryFactory`` class
123+
- ``TlsChannelStreamFactoryFactory`` class
124+
125+
If you configure Netty by using
126+
``MongoClientSettings.Builder.streamFactoryFactory()``, your code might resemble
127+
the following:
128+
129+
.. code-block:: java
130+
:emphasize-lines: 6
131+
:copyable: false
132+
133+
import com.mongodb.connection.netty.NettyStreamFactoryFactory;
134+
135+
// ...
136+
137+
MongoClientSettings settings = MongoClientSettings.builder()
138+
.streamFactoryFactory(NettyStreamFactoryFactory.builder().build())
139+
.build();
140+
141+
Replace this code with the `TransportSettings.nettyBuilder() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/TransportSettings.html>`__
142+
as shown in the following example:
143+
144+
.. code-block:: java
145+
:emphasize-lines: 6
146+
147+
import com.mongodb.connection.TransportSettings;
148+
149+
// ...
150+
151+
MongoClientSettings settings = MongoClientSettings.builder()
152+
.transportSettings(TransportSettings.nettyBuilder().build())
153+
.build();
154+
155+
156+
.. _java-new-features-4.11:
157+
158+
New Features in 4.11
159+
~~~~~~~~~~~~~~~~~~~~
160+
161+
New features of the 4.11 driver release include:
162+
163+
- Support for connecting to MongoDB by using a SOCKS5 proxy. To learn more
164+
see :ref:`java-connect-socks`.
165+
- Added the ``getSplitEvent()`` method to the ``ChangeStreamDocument`` class
166+
to identify fragments of a change stream event that exceeds 16MB. You must
167+
use the aggregation stage ``$changeStreamSplitLargeEvent`` in your change
168+
stream to handle events that exceed 16MB. To learn more, see :ref:`java-split-change-stream-events`.
169+
- Added an aggregation stage builder for ``$vectorSearch``. To learn more, see :ref:`Atlas Vector Search <java-atlas-vector-search>`.
170+
- Added Atlas Search index management helpers. To learn more, see :ref:`Atlas Search Indexes <search-indexes>`.
171+
- Updated Snappy and Zstd compression library dependency versions. To learn
172+
more about the current dependency versions, see :ref:`network-compression`.
173+
- Added ``getElapsedTime()`` methods to the following classes to monitor the
174+
duration of connection pool events:
175+
176+
- `ConnectionCheckOutFailedEvent <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/ConnectionCheckOutFailedEvent.html>`__
177+
- `ConnectionCheckedOutEvent <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/ConnectionCheckedOutEvent.html>`__
178+
- `ConnectionReadyEvent <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/ConnectionReadyEvent.html>`__
179+
180+
- Support for Java 21 virtual threads and structured concurrency. The driver
181+
internals were updated to avoid unnecessary pinning of virtual threads
182+
and to preserve interrupted status of a thread, as the latter matters for
183+
structured concurrency where it is used for cancellation.
184+
185+
To learn more about virtual threads, see the `Virtual Threads <https://openjdk.org/jeps/444>`__
186+
JDK enhancement proposal. To learn more about structured concurrency, see the
187+
`Structured Concurrency <https://openjdk.org/jeps/453>`__
188+
JDK enhancement proposal.
189+
190+
- Updated API documentation for the following types:
191+
192+
- `ClusterListener <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/ClusterListener.html>`__
193+
- `ServerListener <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/ServerListener.html>`__
194+
- `ServerMonitorListener <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/ServerMonitorListener.html>`__
195+
98196

99197
.. _version-4.10:
100198

@@ -112,7 +210,7 @@ New features of the 4.10 driver release include:
112210
retry operations. The driver now correctly emits one log message for
113211
each retry operation.
114212
- The ``org.bson.codecs.Parameterizable`` interface is deprecated. Instead of
115-
implementing this interface on a custom ``Codec`` type, you should
213+
implementing this interface on a custom ``Codec`` type,
116214
override the ``CodecProvider.get()`` method on the
117215
codec's ``CodecProvider`` if the codec is intended for a parameterized
118216
type.
@@ -253,7 +351,7 @@ New features of the 4.7 driver release include:
253351

254352
- Added a new API for encryption key management.
255353

256-
- Added builder API methods for additional aggregation stages
354+
- Added builder API methods for more aggregation stages
257355
including :pipeline:`$search`/:pipeline:`$searchMeta` (Atlas only),
258356
:pipeline:`$densify`, and :pipeline:`$fill`. Learn more about these
259357
methods on the :ref:`Aggregates Builder <aggregates-builders>` page.
@@ -329,12 +427,12 @@ New features of the 4.5 Java driver release include:
329427
in the Java Language Specification.
330428
- Added ``EnumCodec`` and ``EnumCodecProvider`` classes to separate codec
331429
support for ``enum`` types from the ``PojoCodec`` class. The default
332-
codec registries, accessible from the ``MongoClientSettings`` and the ``Bson``
430+
codec registries, which you can access from the ``MongoClientSettings`` and the ``Bson``
333431
interfaces, now include the ``enum`` codec classes. If your application uses
334432
a custom enumeration codec and one of the default registries, ensure
335433
you order them as described in the section on :ref:`overriding codecs <codecs-override>`.
336434
- Resolved performance issues that impacted versions 4.4 and 4.3 of the
337-
driver. Performance in this version should be similar to performance in 4.2.
435+
driver. Performance in this version is similar to performance in 4.2.
338436
- Resolved an issue in which errors originating from retrieving the cluster
339437
description weren't passed to the ``onError`` Subscriber callback
340438
- Resolved an issue with releasing ``ByteBuf`` instances when you connect

0 commit comments

Comments
 (0)