File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed
fundamentals/data-formats Expand file tree Collapse file tree 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
244244
245245.. _kotlin-serialization-snake-case-eg:
246246
247- Enforcing Snake Case Naming Example
248- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
247+ Implement Snake Case Naming Strategy
248+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
249249
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:
252255
253256.. code-block:: kotlin
254257 :copyable: true
@@ -259,10 +262,6 @@ fields into snake case by setting the ``bsonNamingStrategy`` parameter:
259262.. literalinclude:: /examples/generated/KotlinXSerializationTest.snippet.snake-case-naming.kt
260263 :language: kotlin
261264
262- .. note::
263-
264- The ``bsonNamingStrategy`` parameter is available for bson-kotlinx v5.4 and later.
265-
266265For more information about the methods and classes mentioned in this section,
267266see the following API documentation:
268267
Original file line number Diff line number Diff line change @@ -31,9 +31,9 @@ What's New in 5.4
3131The 5.4 driver release includes the following changes, fixes,
3232and features:
3333
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.
3737
3838.. sharedinclude:: dbx/jvm/v5.4-wn-items.rst
3939
You can’t perform that action at this time.
0 commit comments