Skip to content

Commit 013a7b5

Browse files
author
Chris Cho
authored
DOCSP-25464: RecordCodec changes in v4.8 (#300)
* DOCSP-25464: RecordCodec changes in v4.8
1 parent 35ad05e commit 013a7b5

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

source/upgrade.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ Version 4.8 Breaking Changes
6464
module if your application deploys the driver in an OSGi container and
6565
relies on the driver for encoding and decoding Java records.
6666

67+
- The ``RecordCodec``, implemented in v4.6, deserialized POJOs and record
68+
classes that are specified as type parameters of ``List`` or ``Map`` fields
69+
of a record as ``Document`` values instead of their respective classes. This
70+
version now deserializes them to the proper record and POJO types.
71+
72+
For example, the following record class definitions show a ``Book`` record
73+
that contains a ``List`` that receives a ``Chapter`` type parameter:
74+
75+
.. code-block:: java
76+
77+
public record Book(String title, List<Chapter> chapters) {}
78+
public record Chapter(Integer number, String text) {}
79+
80+
Starting in this version, the codec deserializes data in the ``List`` into
81+
``Chapter`` record classes instead of ``Document`` values.
82+
6783
.. _java-breaking-changes-v4.7:
6884

6985
Version 4.7 Breaking Changes
@@ -157,7 +173,7 @@ Version 4.8 Server Release Support Changes
157173

158174
- The v4.8 driver drops support for {+mdb-server+} v3.4 and earlier.
159175
To use the v4.8 driver, your {+mdb-server+} must be v3.6 or later. To learn
160-
how to upgrade your {+mdb-server+} to v3.6, follow the link that corresponds
176+
how to upgrade your {+mdb-server+} to v3.6, follow the link that corresponds
161177
to your MongoDB deployment configuration:
162178

163179
- :ref:`<3.6-upgrade-replica-set>`

source/whats-new.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ Learn what's new in:
3131
What's New in 4.8
3232
-------------------
3333

34-
The 4.8 driver ends support for MongoDB v3.4 and earlier. To learn
35-
more about breaking changes in this driver version and how to address
36-
them, see :ref:`<java-server-release-change-v4.8>`.
34+
- The 4.8 driver ends support for MongoDB v3.4 and earlier. To learn
35+
more about breaking changes in this driver version and how to address
36+
them, see :ref:`<java-server-release-change-v4.8>`.
37+
38+
- The ``RecordCodec`` now deserializes POJOs and record classes that are
39+
specified as type parameters of ``List`` and ``Map`` fields of a record as
40+
their respective classes. To learn more about this change and how this may
41+
affect the behavior of your application, see
42+
:ref:`<java-breaking-changes-v4.8>`.
3743

3844
Behavioral changes with the 4.8 driver release include:
3945

0 commit comments

Comments
 (0)