@@ -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