Skip to content

5.0 Removals #510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion snooty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"
[constants]
driver = "java"
driver-long = "MongoDB Java Driver"
driver-short = "Java Driver"
driver-short = "Java driver"
version = "4.11"
full-version = "{+version+}.1"
mdb-server = "MongoDB Server"
Expand Down
1 change: 0 additions & 1 deletion source/fundamentals/collations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ only binary comparison:

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

.. _collations-options:

Expand Down
156 changes: 122 additions & 34 deletions source/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,41 +61,24 @@ the version after v4.0 including any listed under v4.5.
Version 5.0 Breaking Changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- This driver version introduces the following changes to the ``ConnectionId`` class:

- The ``ConnectionId`` constructor now accepts a value of type ``long`` as its second
parameter instead of type ``int``. Similarly, the constructor now accepts a value of
type ``Long`` as its third parameter instead of type ``Integer``. Because this change breaks
binary compatibility, recompile any existing code that calls the ``ConnectionId`` constructor.

- The ``withServerValue()`` method now accepts a parameter of type ``long`` rather than
type ``int``. This change breaks binary compatibility, so you must recompile any code
that calls the ``withServerValue()`` method.
This driver version introduces the following breaking changes:

- The ``getServerValue()`` method now returns a value of type ``Long`` instead of type
``Integer``. Similarly, the ``getLocalValue()`` method returns a value of type
``long`` instead of type ``int``. Because this change breaks both binary and source
compatibility, update any source code that uses these methods and rebuild your binary.
- Changes the data type of the timeout duration parameter in the
``SocketSettings.Builder.connectTimeout()`` and ``SocketSettings.Builder.readTimeout()``
methods. The data type of this parameter is now ``long`` instead of ``int``.
To view an
example that shows how to instantiate a ``SocketSettings`` instance by using
these methods, see the :ref:`SocketSettings Example
<java-socketsettings-example>` in the Specify MongoClient Settings
guide.
Comment on lines +66 to +73
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This text effectively duplicates the text below (search for connectTimeout, readTimeout, java-socketsettings-example). The latter was reviewed in #507.

Suggested change
- Changes the data type of the timeout duration parameter in the
``SocketSettings.Builder.connectTimeout()`` and ``SocketSettings.Builder.readTimeout()``
methods. The data type of this parameter is now ``long`` instead of ``int``.
To view an
example that shows how to instantiate a ``SocketSettings`` instance by using
these methods, see the :ref:`SocketSettings Example
<java-socketsettings-example>` in the Specify MongoClient Settings
guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm not seeing the duplicate text; could you specify where it is?

Copy link
Member

@stIncMale stIncMale Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, that text wasn't duplicated, it was removed and replaced with the text I quoted originally. The removed text has already been reviewed and updated in #507, more specifically, in the following commit: 7e55ff2.

The fact that this PR does not have those modifications, yet also updates that text suggests that something went wrong (fortunately, Git complains about the conflict in source/upgrade.txt, as expected). Anyway, I am asking to incorporate the changes made in the commit 7e55ff2 to files source/includes/fundamentals/code-snippets/mcs.java and source/upgrade.txt into the current PR (the list below gives an overview of the changes I am talking about, the linked commit contains all of these changes):

  1. The L suffixes in the example are not needed.
  2. The example does not show how to instantiate SocketSettings.
  3. We need to inform users that this change breaks binary compatibility.


- This driver version removes the following record annotations:
- Removes the following record annotations:

- ``BsonId``
- ``BsonProperty``
- ``BsonRepresentation``

- You must pass a timeout duration, which is the first parameter, to the
following ``SocketSettings`` builder methods as a ``long`` type:

- ``connectTimeout()``
- ``readTimeout()``

In earlier versions, this parameter is of type ``int`` for both methods. To view an example
that shows how to instantiate a ``SocketSettings`` instance by using
these methods, see the :ref:`SocketSettings Example
<java-socketsettings-example>` in the Specify MongoClient Settings
guide.

- This driver version removes the ``Filters.eqFull()`` method, which allowed you
- Removes the ``Filters.eqFull()`` method, which allowed you
to construct an equality filter when performing a vector search.
You can use the ``Filters.eq()`` method when instantiating a
``VectorSearchOptions`` type, as shown in the following code:
Expand All @@ -105,16 +88,121 @@ Version 5.0 Breaking Changes
VectorSearchOptions opts = vectorSearchOptions().filter(eq("x", 8));

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

.. After the 5.0 Scala API docs are released, this line will be uncommented.
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>`__.

- Removes the ``Parameterizable`` interface. Instead of
implementing this interface on a custom ``Codec`` type,
override the ``CodecProvider.get()`` method on the
codec's ``CodecProvider`` if the codec is intended for a parameterized
type.

- Removes the ``isSlaveOk()`` method from the
``ReadPreference`` and ``TaggableReadPreference`` classes. To check whether a read preference allows
reading from a secondary member of a replica set, use the ``isSecondaryOk()`` methods from
these classes instead.

- Removes the ``DBCollection.getStats()`` and ``DBCollection.isCapped()``
helper methods for the ``collStats`` command. Instead of these methods, you can use the
``$collStats`` aggregation pipeline stage. For an example of how to use this pipeline
stage, see :manual:`What's New <java-deprecations-4.11>` for v4.11 of the {+driver-short+}.

- Removes the ``IterableCodec`` and ``MapCodec`` types.
Use ``MapCodecProvider`` instead of ``MapCodec``, and ``CollectionCodecProvider``
instead of ``IterableCodec``.

- Removes the ``sharded`` and ``nonAtomic`` options from the
``MapReducePublisher`` and ``MapReduceIterable`` classes.

- This driver version removes the
- Removes the following methods for use with ``geoHaystack`` indexes:

- ``Indexes.geoHaystack()``
- ``IndexOptions.getBucketSize()``
- ``IndexOptions.bucketSize()``

Instead, you can use the ``$geoNear`` aggregation pipeline stage or a geospatial
query operator on a 2d index. For more information, see the
:manual:`Geospatial Queries page </geospatial-queries>` in the {+mdb-server+} manual.

- Removes the ``oplogReplay`` option from find operations. This
includes the following methods:

- ``DBCursor.oplogReplay()``
- ``DBCollectionFindOptions.isOplogReplay()``
- ``DBCollectionFindOptions.oplogReplay()``
- ``FindPublisher.oplogReplay()``
- ``FindIterable.oplogReplay()``

- Removes the following ``Exception`` constructors:

- ``MongoBulkWriteException(BulkWriteResult, List<BulkWriteError>, WriteConcernError, ServerAddress)``
- ``MongoCursorNotFoundException(long, ServerAddress)``
- ``MongoQueryException(ServerAddress, int, String)``
- ``MongoQueryException(ServerAddress, int, String, String)``
- ``MongoQueryException(MongoCommandException)``

- Removes the following overloads for the ``BulkWriteResult.acknowledged()`` method:

- ``acknowledged(Type, int, List<BulkWriteUpsert>)``
- ``acknowledged(Type, int, Integer, List<BulkWriteUpsert>)``
- ``acknowledged(int, int, int, Integer, List<BulkWriteUpsert>)<String>)``

- Removes the following ``ChangeStreamDocument`` constructors:

- ``ChangeStreamDocument(String, BsonDocument, BsonDocument, BsonDocument, TDocument, TDocument, BsonDocument, ...)``
- ``ChangeStreamDocument(String, BsonDocument, BsonDocument, BsonDocument, TDocument, BsonDocument, BsonTimestamp, ...)``
- ``ChangeStreamDocument(OperationType, BsonDocument, BsonDocument, BsonDocument, TDocument, BsonDocument, BsonTimestamp, ...)``

- Removes the following constructors for events:

- ``CommandEvent(RequestContext, int, ConnectionDescription, String)``
- ``CommandEvent(int, ConnectionDescription, String)``
- ``CommandEvent(RequestContext, long, int, ConnectionDescription, String)``
- ``CommandFailedEvent(RequestContext, int, ConnectionDescription, String, long, Throwable)``
- ``CommandFailedEvent(int, ConnectionDescription, String, long, Throwable)``
- ``CommandStartedEvent(RequestContext, int, ConnectionDescription, String, String, BsonDocument)``
- ``CommandStartedEvent(int, ConnectionDescription, String, String, BsonDocument)``
- ``CommandSucceededEvent(RequestContext, int, ConnectionDescription, String, BsonDocument, long)``
- ``CommandSucceededEvent(int, ConnectionDescription, String, BsonDocument, long)``
- ``ConnectionCheckedInEvent(ConnectionId)``
- ``ConnectionCheckedOutEvent(ConnectionId, long)``
- ``ConnectionCheckedOutEvent(ConnectionId)``
- ``ConnectionCheckOutFailedEvent(ServerId, long, Reason)``
- ``ConnectionCheckOutFailedEvent(ServerId, Reason)``
- ``ConnectionCheckOutStartedEvent(ServerId)``
- ``ConnectionReadyEvent(ConnectionId)``
- ``ServerHeartbeatFailedEvent(ConnectionId, long, Throwable)``
- ``ServerHeartbeatSucceededEvent(ConnectionId, BsonDocument, long)``

- Removes the ``errorLabels`` option from the ``WriteConcernError``
class. This includes the ``addLabel()`` and ``getErrorLabels()`` methods and the
constructor that includes an ``errorLabels`` parameter. Instead, you can use
the error labels included in the top-level response document.

- Removes the
``org.mongodb.scala.ObservableImplicits.ToSingleObservableVoid`` implicit
class. This means the ``org.reactivestreams.Publisher[Void]`` type no longer
converts automatically to ``org.mongodb.scala.SingleObservable[Void]``. The also
API exposes ``org.mongodb.scala.Observable[Unit]`` instead of
class from the Scala driver package. This means the
``org.reactivestreams.Publisher[Void]`` type no longer
converts automatically to ``org.mongodb.scala.SingleObservable[Void]``. The
API also exposes ``org.mongodb.scala.Observable[Unit]`` instead of
``org.mongodb.scala.Observable[Void]``.

- Introduces the following changes to the ``ConnectionId`` class:

.. After the 5.0 Scala API docs are released, this line will be uncommented.
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>`__.
- The ``ConnectionId`` constructor now accepts a value of type ``long`` as its second
parameter instead of type ``int``. Similarly, the constructor now accepts a value of
type ``Long`` as its third parameter instead of type ``Integer``. Because this change breaks
binary compatibility, recompile any existing code that calls the ``ConnectionId`` constructor.

- The ``withServerValue()`` method now accepts a parameter of type ``long`` rather than
type ``int``. This change breaks binary compatibility, so you must recompile any code
that calls the ``withServerValue()`` method.

- The ``getServerValue()`` method now returns a value of type ``Long`` instead of type
``Integer``. Similarly, the ``getLocalValue()`` method returns a value of type
``long`` instead of type ``int``. Because this change breaks both binary and source
compatibility, update any source code that uses these methods and rebuild your binary.

.. _java-breaking-changes-v4.8:

Expand Down
7 changes: 3 additions & 4 deletions source/whats-new.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,9 @@ What's New in 4.8

.. important:: Deprecation Notice

The ``IterableCodec`` and ``MapCodec`` classes are deprecated. Instead,
use ``CollectionCodec`` and ``MapCodecV2``.
These support any class that implements ``Collection`` or
``Map``.
The ``IterableCodec`` and ``MapCodec`` classes are deprecated.
Use ``MapCodecProvider`` instead of ``MapCodec`` and ``CollectionCodecProvider``
instead of ``IterableCodec``.

Behavioral changes with the 4.8 driver release include:

Expand Down