File tree 2 files changed +10
-11
lines changed
fundamentals/data-formats
2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -244,11 +244,14 @@ The following example shows how to create a codec using the
244
244
245
245
.. _kotlin-serialization-snake-case-eg:
246
246
247
- Enforcing Snake Case Naming Example
248
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
247
+ Implement Snake Case Naming Strategy
248
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
249
249
250
- The following example shows how to convert field names from their data class
251
- fields into snake case by setting the ``bsonNamingStrategy`` parameter:
250
+ When using ``bson-kotlinx`` package v5.4 or later, you can direct the driver to
251
+ serialize data class fields names written in camel case to snake case in MongoDB.
252
+ The following example shows how to create and register a custom codec
253
+ to convert data class field names into snake case by setting the
254
+ ``bsonNamingStrategy`` parameter in a codec:
252
255
253
256
.. code-block:: kotlin
254
257
:copyable: true
@@ -259,10 +262,6 @@ fields into snake case by setting the ``bsonNamingStrategy`` parameter:
259
262
.. literalinclude:: /examples/generated/KotlinXSerializationTest.snippet.snake-case-naming.kt
260
263
:language: kotlin
261
264
262
- .. note::
263
-
264
- The ``bsonNamingStrategy`` parameter is available for bson-kotlinx v5.4 and later.
265
-
266
265
For more information about the methods and classes mentioned in this section,
267
266
see the following API documentation:
268
267
Original file line number Diff line number Diff line change @@ -31,9 +31,9 @@ What's New in 5.4
31
31
The 5.4 driver release includes the following changes, fixes,
32
32
and features:
33
33
34
- - Adds support for converting field names to snake case during serialization. To
35
- learn more, see the :ref:`kotlin-serialization-snake-case-eg` on the
36
- Serialization page.
34
+ - Adds ``BsonConfiguration`` support for bson-kotlinx snake case conversion
35
+ during serialization. To learn more, see the
36
+ :ref:`kotlin-serialization-snake-case-eg` on the Serialization page.
37
37
38
38
.. sharedinclude:: dbx/jvm/v5.4-wn-items.rst
39
39
You can’t perform that action at this time.
0 commit comments