Skip to content

Instantly share code, notes, and snippets.

View hrothwell's full-sized avatar

Haiden hrothwell

View GitHub Profile
@hrothwell
hrothwell / mongoDbKotlinDriversWithKMongoCodec.kt
Last active October 4, 2023 04:25
Using Mongodb Kotlin drivers with default KMongo codec
/**
* Q: Why use KMongo's default codec over the official Mongodb Kotlin drivers' default codec or Kotlinx.serialization?
* A: Having been using KMongo for several years at an enterprise level, having to switch to a new codec or
* rework all of our data to be handled via this new codec seemed like more effort than it was worth at the moment.
*
* Q: Isn't KMongo deprecated? Why depend on it just for this?
* A: Yes it is deprecated, however, it is also assumed/expected that many users of KMongo will still be using
* KMongo's nicer / more intuitive query building tools / syntax. Until that query building logic is split off into its own project,
* we will still be pulling it in anyways. On top of this, I am just hopeful that the default codec that KMongo utilizes will also
* still be available to make transitions for others easier even if the base project is no longer available, fingers crossed!