Skip to content

Can't find a codec for CodecCacheKey{clazz=interface java.util.List, types=null}. #4750

@TDxushengdong

Description

@TDxushengdong

Spring Data MongoDb 4.2.4
MongoDb Driver 4.11.1

I use the following code to query mongodb. Although it returns the correct result when querying, why does the underlying source code throw the exception Can't find a codec for CodecCacheKey{clazz=interface java.util.List, types=null}.org.bson.codecs.configuration.CodecConfigurationException Although this exception is caught

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>
)

image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions