Skip to content

Commit c091148

Browse files
5.0 Removals - Rebase (#521)
* add 5.0 removals Co-authored-by: Mike Woofter <[email protected]>
1 parent c803a65 commit c091148

File tree

4 files changed

+113
-25
lines changed

4 files changed

+113
-25
lines changed

snooty.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"
1818
[constants]
1919
driver = "java"
2020
driver-long = "MongoDB Java Driver"
21-
driver-short = "Java Driver"
21+
driver-short = "Java driver"
2222
version = "4.11"
2323
full-version = "{+version+}.1"
2424
mdb-server = "MongoDB Server"

source/fundamentals/collations.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ only binary comparison:
239239

240240
- :manual:`text </reference/method/db.collection.createIndex/#options-for-text-indexes>`
241241
- :manual:`2d </reference/method/db.collection.createIndex/#options-for-2dsphere-indexes>`
242-
- :manual:`geoHaystack </reference/method/db.collection.createIndex/#options-for-geohaystack-indexes>`
243242

244243
.. _collations-options:
245244

source/upgrade.txt

Lines changed: 108 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ the version after v4.0 including any listed under v4.5.
6161
Version 5.0 Breaking Changes
6262
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6363

64-
- This driver version introduces the following changes to the ``ConnectionId`` class:
64+
This driver version introduces the following breaking changes:
6565

66+
- Introduces the following changes to the ``ConnectionId`` class:
67+
6668
- The ``ConnectionId`` constructor now accepts a value of type ``long`` as its second
6769
parameter instead of type ``int``. Similarly, the constructor now accepts a value of
6870
type ``Long`` as its third parameter instead of type ``Integer``. Because this change breaks
@@ -85,21 +87,18 @@ Version 5.0 Breaking Changes
8587
- ``BsonProperty``
8688
- ``BsonRepresentation``
8789

88-
- You must pass a timeout duration, which is the first parameter, to the
89-
following ``SocketSettings`` builder methods as a ``long`` type:
90-
91-
- ``connectTimeout()``
92-
- ``readTimeout()``
93-
94-
In earlier versions, this parameter is of type ``int`` for both methods. To view an example
95-
that shows how to call ``SocketSettings`` methods, see the :ref:`SocketSettings Example
96-
<java-socketsettings-example>` in the Specify MongoClient Settings
97-
guide.
98-
99-
This change breaks binary compatibility (requires recompiling) but does not
100-
require code changes.
101-
102-
- This driver version removes the ``Filters.eqFull()`` method, released
90+
- Changes the data type of the timeout duration parameter in the
91+
``SocketSettings.Builder.connectTimeout()`` and
92+
``SocketSettings.Builder.readTimeout()`` methods. The data type of this
93+
parameter is now ``long`` instead of ``int``.
94+
95+
In earlier versions, this parameter is of type ``int`` for both methods. This
96+
change breaks binary compatibility and requires recompiling, but does not
97+
require code changes. To view an example that shows how to call
98+
``SocketSettings`` methods, see the :ref:`SocketSettings Example
99+
<java-socketsettings-example>` in the Specify MongoClient Settings guide.
100+
101+
- Removes the ``Filters.eqFull()`` method, released
103102
exclusively in ``Beta``, which allowed you
104103
to construct an equality filter when performing a vector search.
105104
You can use the ``Filters.eq()`` method when instantiating a
@@ -111,7 +110,7 @@ Version 5.0 Breaking Changes
111110

112111
.. _java-breaking-changes-v5.0-observables:
113112

114-
- This driver version removes the
113+
- Removes the
115114
``org.mongodb.scala.ObservableImplicits.ToSingleObservableVoid`` implicit
116115
class. This means the ``org.reactivestreams.Publisher[Void]`` type no longer
117116
converts automatically to ``org.mongodb.scala.SingleObservable[Void]``. The
@@ -121,7 +120,7 @@ Version 5.0 Breaking Changes
121120
.. After the 5.0 Scala API docs are released, this line will be uncommented.
122121
For more information, see the `Observable trait documentation <https://mongodb.github.io/mongo-java-driver/5.0/apidocs/mongo-scala-driver/org/mongodb/scala/Observable.html>`__.
123122

124-
- This driver changes how ``ClusterSettings`` computes
123+
- Changes how ``ClusterSettings`` computes
125124
``ClusterConnectionMode``, making it more consistent by using the specified
126125
replica set name, regardless of how it is configured. Previously, replica set
127126
name was only considered if it was set by the connection string.
@@ -147,11 +146,101 @@ Version 5.0 Breaking Changes
147146
.build()
148147
.getMode()
149148

150-
- This driver changes how ``BsonDecimal128`` values respond to method calls, by
149+
- Changes how ``BsonDecimal128`` values respond to method calls, by
151150
responding in the same way as ``Decimal128`` values. In particular,
152151
``BsonDecimal128.isNumber()`` now returns ``true``, and
153152
``BsonDecimal128.asNumber()`` returns the equivalent ``BsonNumber``.
154153

154+
- Removes the ``Parameterizable`` interface. Instead of
155+
implementing this interface on a custom ``Codec`` type,
156+
override the ``CodecProvider.get()`` method on the
157+
codec's ``CodecProvider`` if the codec is intended for a parameterized
158+
type.
159+
160+
- Removes the ``isSlaveOk()`` method from the
161+
``ReadPreference`` and ``TaggableReadPreference`` classes. To check whether a read preference allows
162+
reading from a secondary member of a replica set, use the ``isSecondaryOk()`` methods from
163+
these classes instead.
164+
165+
- Removes the ``DBCollection.getStats()`` and ``DBCollection.isCapped()``
166+
helper methods for the ``collStats`` command. Instead of these methods, you can use the
167+
``$collStats`` aggregation pipeline stage. For an example of how to use this pipeline
168+
stage, see :manual:`What's New <java-deprecations-4.11>` for v4.11 of the {+driver-short+}.
169+
170+
- Removes the ``MapCodec`` and ``IterableCodec`` classes.
171+
Instead of ``MapCodec``, use ``MapCodecProvider``. Instead of ``IterableCodec``,
172+
use ``CollectionCodecProvider``, or ``IterableCodecProvider`` for ``Iterable``
173+
types that aren't ``Collection`` types.
174+
175+
- Removes the ``sharded()`` and ``nonAtomic()`` methods from the
176+
``MapReducePublisher`` and ``MapReduceIterable`` classes.
177+
178+
- Removes the following methods for use with ``geoHaystack`` indexes:
179+
180+
- ``Indexes.geoHaystack()``
181+
- ``IndexOptions.getBucketSize()``
182+
- ``IndexOptions.bucketSize()``
183+
184+
Instead, you can use the ``$geoNear`` aggregation pipeline stage or a geospatial
185+
query operator on a 2d index. For more information, see the
186+
:manual:`Geospatial Queries page </geospatial-queries>` in the {+mdb-server+} manual.
187+
188+
- Removes the ``oplogReplay`` option from find operations. This
189+
includes the following methods:
190+
191+
- ``DBCursor.oplogReplay()``
192+
- ``DBCollectionFindOptions.isOplogReplay()``
193+
- ``DBCollectionFindOptions.oplogReplay()``
194+
- ``FindPublisher.oplogReplay()``
195+
- ``FindIterable.oplogReplay()``
196+
197+
- Removes the following ``Exception`` constructors:
198+
199+
- ``MongoBulkWriteException(BulkWriteResult, List<BulkWriteError>, WriteConcernError, ServerAddress)``
200+
- ``MongoCursorNotFoundException(long, ServerAddress)``
201+
- ``MongoQueryException(ServerAddress, int, String)``
202+
- ``MongoQueryException(ServerAddress, int, String, String)``
203+
- ``MongoQueryException(MongoCommandException)``
204+
205+
- Removes the following overloads for the ``BulkWriteResult.acknowledged()`` method:
206+
207+
- ``acknowledged(Type, int, List<BulkWriteUpsert>)``
208+
- ``acknowledged(Type, int, Integer, List<BulkWriteUpsert>)``
209+
- ``acknowledged(int, int, int, Integer, List<BulkWriteUpsert>)``
210+
211+
- Removes the following ``ChangeStreamDocument`` constructors:
212+
213+
- ``ChangeStreamDocument(String, BsonDocument, BsonDocument, BsonDocument, TDocument, TDocument, BsonDocument, ...)``
214+
- ``ChangeStreamDocument(String, BsonDocument, BsonDocument, BsonDocument, TDocument, BsonDocument, BsonTimestamp, ...)``
215+
- ``ChangeStreamDocument(OperationType, BsonDocument, BsonDocument, BsonDocument, TDocument, BsonDocument, BsonTimestamp, ...)``
216+
217+
- Removes the following constructors for events:
218+
219+
- ``CommandEvent(RequestContext, int, ConnectionDescription, String)``
220+
- ``CommandEvent(int, ConnectionDescription, String)``
221+
- ``CommandEvent(RequestContext, long, int, ConnectionDescription, String)``
222+
- ``CommandFailedEvent(RequestContext, int, ConnectionDescription, String, long, Throwable)``
223+
- ``CommandFailedEvent(int, ConnectionDescription, String, long, Throwable)``
224+
- ``CommandStartedEvent(RequestContext, int, ConnectionDescription, String, String, BsonDocument)``
225+
- ``CommandStartedEvent(int, ConnectionDescription, String, String, BsonDocument)``
226+
- ``CommandSucceededEvent(RequestContext, int, ConnectionDescription, String, BsonDocument, long)``
227+
- ``CommandSucceededEvent(int, ConnectionDescription, String, BsonDocument, long)``
228+
- ``ConnectionCheckedInEvent(ConnectionId)``
229+
- ``ConnectionCheckedOutEvent(ConnectionId, long)``
230+
- ``ConnectionCheckedOutEvent(ConnectionId)``
231+
- ``ConnectionCheckOutFailedEvent(ServerId, long, Reason)``
232+
- ``ConnectionCheckOutFailedEvent(ServerId, Reason)``
233+
- ``ConnectionCheckOutStartedEvent(ServerId)``
234+
- ``ConnectionReadyEvent(ConnectionId)``
235+
- ``ServerHeartbeatFailedEvent(ConnectionId, long, Throwable)``
236+
- ``ServerHeartbeatSucceededEvent(ConnectionId, BsonDocument, long)``
237+
238+
- Removes the ``errorLabels`` option from the ``WriteConcernError``
239+
class. This includes the ``addLabel()`` and ``getErrorLabels()`` methods and the
240+
constructor that includes an ``errorLabels`` parameter. Instead, you can use
241+
the error labels included in the ``MongoException`` object that contains the
242+
``WriteConcernError``.
243+
155244
.. _java-breaking-changes-v4.8:
156245

157246
Version 4.8 Breaking Changes

source/whats-new.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,10 @@ What's New in 4.8
285285

286286
.. important:: Deprecation Notice
287287

288-
The ``IterableCodec`` and ``MapCodec`` classes are deprecated. Instead,
289-
use ``CollectionCodec`` and ``MapCodecV2``.
290-
These support any class that implements ``Collection`` or
291-
``Map``.
288+
The ``MapCodec`` and ``IterableCodec`` classes are deprecated.
289+
Instead of ``MapCodec``, use ``MapCodecProvider``. Instead of ``IterableCodec``,
290+
use ``CollectionCodecProvider``, or ``IterableCodecProvider`` for ``Iterable``
291+
types that aren't ``Collection`` types.
292292

293293
Behavioral changes with the 4.8 driver release include:
294294

0 commit comments

Comments
 (0)