Spring Data MongoDb 4.2.4
MongoDb Driver 4.11.1
I use the following code to query mongodb. Although this exception is caughtAlthough the result is as expected, the exception is caught from the internal code. It will affect Dynatrace’s exception reporting, How can I avoid such this exception?
Can't find a codec for CodecCacheKey{clazz=interface java.util.List, types=null}.org.bson.codecs.configuration.CodecConfigurationException
interface AccountSettingsRepository : MongoRepository<AccountSettings, String> {
@Meta(maxExecutionTimeMs = 50)
@Query(fields = "{'blacklist': 1}")
fun findByAccountId(accountId: String): AccountSettings?
}
@Document(collection = "accounts")
data class AccountSettings(
@Id
val accountId: String,
@Value("#root.blacklist ?: {}")
val blacklist: List<String>
)
I tried to register a corresponding List codec to avoid the code going to the catch process, but it didn’t work
New contributor
Shengdong Xu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.