https://kotlinlang.org logo
Title
b

Big Chungus

12/08/2020, 8:14 PM
What do you guys use for mongodb in your ktor apps?
m

Marc Knaup

12/08/2020, 8:17 PM
b

Big Chungus

12/08/2020, 8:18 PM
Looks like kmongo is more of what I need. Your lib is missing object mapping/serialization 😕
m

Marc Knaup

12/08/2020, 8:19 PM
You’ll have to write your own codecs. I’ve used KMongo before and got rid of it because they convert everything to intermediary JSON and that led to many bugs. I also didn’t like their library API.
But that was a year ago
I’ve got to write a compiler plugin that creates all these codes 🙂
b

Big Chungus

12/08/2020, 8:24 PM
Odd, can;t find any mentions of having to write codecs on their docs
Ah, since v3.11.2 they've added kotlinx.serialization support which "generates" the codecs i guess
m

Marc Knaup

12/08/2020, 8:29 PM
No, I mean in my library I write codecs
You can’t really created codecs from kotlinx.serialization.
You can only use some JSON intermediary as crutch.
Codecs are too deeply coupled to the MongoDB driver to make good use of kotlinx.serialization.
I wouldn’t want to use kotlinx.serialization for that anyway 😅 I keep hitting limitations way too fast with that.
v