Good day All,
I am using the latest Kotlin Coroutine driver (org.mongodb:mongodb-driver-kotlin-coroutine:4.10.2) to connect to my local MongoDB instance (running locally via docker).
Following the quick start guides I am able to connect to DB, send a ping and create a new empty collection with no issues.
But when I try to insert a new record to my new collection, I get a codec not found error:
org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for CodecCacheKey{clazz=class com.example.kotlinmongo.SampleEntity, types=null}.
My entity type is a fairly trivial data class, which contains a single String field and according to the following page kotlin data classes are supposed to be serialized/de-serialized out-of-the-box using a default codec.
I tried a data class only with primitive types, I tried it with @BsonId field, tried with and without kotlinx serialization library in the project - same result.
I am using JDK17 and Kotlin 1.8.
Am I missing something or found a bug?
Here’s a sample code repo to reproduce the problem:
Appreciate your help!