Skip to content

Commit f2b7d20

Browse files
committed
DOCSP-35154: Remove Java 11 requirement (#494)
* DOCSP-35154: Remove Java 11 requirement * remove extra files (cherry picked from commit a06187b) (cherry picked from commit e7240fe)
1 parent 0c67690 commit f2b7d20

File tree

1 file changed

+155
-1
lines changed

1 file changed

+155
-1
lines changed

source/whats-new.txt

Lines changed: 155 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,161 @@ Upcoming Breaking Changes
3737
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)>`__
3838
are deprecated in MongoDB v4.2 and later. They will be replaced by the
3939
aggregation framework and removed in a future release.
40-
- Beginning with v5.0, the {+driver-short+} will require Java 11 or later.
40+
41+
.. _version-4.11:
42+
43+
What's New in 4.11
44+
------------------
45+
46+
This section includes the following information:
47+
48+
- :ref:`java-deprecations-4.11`
49+
- :ref:`java-new-features-4.11`
50+
51+
.. _java-deprecations-4.11:
52+
53+
Deprecations in 4.11
54+
~~~~~~~~~~~~~~~~~~~~
55+
56+
.. warning:: Deprecations in this release
57+
58+
To avoid breaking changes in future major releases of the driver,
59+
replace any application code that depends on deprecated methods and types.
60+
61+
The 4.11 driver release deprecates the following items:
62+
63+
- The ``getStats()`` and ``isCapped()`` instance methods of the
64+
``DBCollection`` class are deprecated. The corresponding server
65+
commands are deprecated in MongoDB v6.2 and later. Use the ``$collStats``
66+
aggregation pipeline stage to retrieve the information provided by these
67+
methods instead. You can run the aggregation as shown in the following code
68+
example:
69+
70+
.. code-block:: java
71+
72+
Cursor cursor = collection.aggregate(Arrays.asList(
73+
new BasicDBObject("$collStats",
74+
new BasicDBObject("storageStats", new BasicDBObject()))),
75+
AggregationOptions.builder().build()
76+
);
77+
78+
To determine whether a collection is a capped collection, access the value
79+
of the ``storageStats.capped`` field returned by ``Cursor`` instance in the
80+
preceding example aggregation.
81+
82+
To learn more about the ``$collStats`` aggregation operator, see the
83+
:manual:`$collStats (aggregation) </reference/operator/aggregation/collStats/>`
84+
Server manual entry.
85+
86+
- The following network address-related methods are deprecated and will be removed
87+
in v5.0:
88+
89+
- The `ServerAddress <{+api+}/apidocs/mongodb-driver-core/com/mongodb/ServerAddress.html>`__
90+
methods ``getSocketAddress()`` and ``getSocketAddresses()``.
91+
92+
Instead of ``getSocketAddress()``, use the ``getByName()`` instance
93+
method of ``java.net.InetAddress``.
94+
95+
Instead of ``getSocketAddresses()``, use the ``getAllByName()`` instance
96+
method of ``java.net.InetAddress``.
97+
98+
- The `UnixServerAddress <{+api+}/apidocs/mongodb-driver-core/com/mongodb/UnixServerAddress.html>`__
99+
method ``getUnixSocketAddress()``.
100+
101+
Instead of ``getUnixSocketAddress()``, construct an instance of
102+
``jnr.unixsocket.UnixSocketAddress``. Pass the full path of the UNIX
103+
socket file to the constructor. By default, MongoDB creates a UNIX
104+
socket file located at ``"/tmp/mongodb-27017.sock"``. To learn more
105+
about the ``UnixSocketAddress``, see the `UnixSocketAddress <https://www.javadoc.io/doc/com.github.jnr/jnr-unixsocket/latest/jnr/unixsocket/UnixSocketAddress.html>`__ API documentation.
106+
107+
- The following methods and types related to the
108+
`StreamFactory <https://mongodb.github.io/mongo-java-driver/4.10/apidocs/mongodb-driver-core/com/mongodb/connection/StreamFactory.html>`__
109+
interface are deprecated and scheduled for removal in v5.0:
110+
111+
- ``streamFactoryFactory()`` method from ``MongoClientSettings.Builder``
112+
- ``getStreamFactoryFactory()`` method from ``MongoClientSettings``
113+
- ``NettyStreamFactoryFactory`` class
114+
- ``NettyStreamFactory`` class
115+
- ``AsynchronousSocketChannelStreamFactory`` class
116+
- ``AsynchronousSocketChannelStreamFactoryFactory`` class
117+
- ``BufferProvider`` class
118+
- ``SocketStreamFactory`` class
119+
- ``Stream`` class
120+
- ``StreamFactory`` class
121+
- ``StreamFactoryFactory`` class
122+
- ``TlsChannelStreamFactoryFactory`` class
123+
124+
If you configure Netty by using
125+
``MongoClientSettings.Builder.streamFactoryFactory()``, your code might resemble
126+
the following:
127+
128+
.. code-block:: java
129+
:emphasize-lines: 6
130+
:copyable: false
131+
132+
import com.mongodb.connection.netty.NettyStreamFactoryFactory;
133+
134+
// ...
135+
136+
MongoClientSettings settings = MongoClientSettings.builder()
137+
.streamFactoryFactory(NettyStreamFactoryFactory.builder().build())
138+
.build();
139+
140+
Replace this code with the `TransportSettings.nettyBuilder() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/TransportSettings.html>`__
141+
as shown in the following example:
142+
143+
.. code-block:: java
144+
:emphasize-lines: 6
145+
146+
import com.mongodb.connection.TransportSettings;
147+
148+
// ...
149+
150+
MongoClientSettings settings = MongoClientSettings.builder()
151+
.transportSettings(TransportSettings.nettyBuilder().build())
152+
.build();
153+
154+
155+
.. _java-new-features-4.11:
156+
157+
New Features in 4.11
158+
~~~~~~~~~~~~~~~~~~~~
159+
160+
New features of the 4.11 driver release include:
161+
162+
- Support for connecting to MongoDB by using a SOCKS5 proxy. To learn more
163+
see :ref:`java-connect-socks`.
164+
- Added the ``getSplitEvent()`` method to the ``ChangeStreamDocument`` class
165+
to identify fragments of a change stream event that exceeds 16MB. You must
166+
use the aggregation stage ``$changeStreamSplitLargeEvent`` in your change
167+
stream to handle events that exceed 16MB. To learn more, see :ref:`java-split-change-stream-events`.
168+
- Added an aggregation stage builder for ``$vectorSearch``. To learn more, see :ref:`Atlas Vector Search <java-atlas-vector-search>`.
169+
- Added Atlas Search index management helpers. To learn more, see :ref:`Atlas Search Indexes <search-indexes>`.
170+
- Updated Snappy and Zstd compression library dependency versions. To learn
171+
more about the current dependency versions, see :ref:`network-compression`.
172+
- Added ``getElapsedTime()`` methods to the following classes to monitor the
173+
duration of connection pool events:
174+
175+
- `ConnectionCheckOutFailedEvent <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/ConnectionCheckOutFailedEvent.html>`__
176+
- `ConnectionCheckedOutEvent <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/ConnectionCheckedOutEvent.html>`__
177+
- `ConnectionReadyEvent <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/ConnectionReadyEvent.html>`__
178+
179+
- Support for Java 21 virtual threads and structured concurrency. The driver
180+
internals were updated to avoid unnecessary pinning of virtual threads
181+
and to preserve interrupted status of a thread, as the latter matters for
182+
structured concurrency where it is used for cancellation.
183+
184+
To learn more about virtual threads, see the `Virtual Threads <https://openjdk.org/jeps/444>`__
185+
JDK enhancement proposal. To learn more about structured concurrency, see the
186+
`Structured Concurrency <https://openjdk.org/jeps/453>`__
187+
JDK enhancement proposal.
188+
189+
- Updated API documentation for the following types:
190+
191+
- `ClusterListener <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/ClusterListener.html>`__
192+
- `ServerListener <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/ServerListener.html>`__
193+
- `ServerMonitorListener <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/ServerMonitorListener.html>`__
194+
41195

42196
.. _version-4.9:
43197

0 commit comments

Comments
 (0)