Skip to content

Commit e7240fe

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

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

40194
.. _version-4.10:
41195

0 commit comments

Comments
 (0)