Skip to content

Support for @JsonValue custom ID types #224

@marquiswang

Description

@marquiswang

I'm finally trying to migrate from 2.x. I have a lot of code of the form:

JacksonDBCollection.wrap(collection, SomeType.class, CustomId.class, objectMapper);

where CustomId is a class with @JsonValue and @JsonCreator annotations that allow Jackson to serialize it to a string. With 2.x, this was supported and used the String serialization of CustomId as the id.

With 3.x and 4.x, the generic key type has been removed from JacksonMongoCollection, and I get the following error when trying to insert:

java.lang.IllegalArgumentException: Unsupported ID type: class foo.bar.CustomId

Is there any way to get the equivalent old functionality?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions