Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex objects in queries or updates fail to convert

Closed
rlodge opened this issue Feb 5, 2020 · 0 comments
Closed

Complex objects in queries or updates fail to convert #197

rlodge opened this issue Feb 5, 2020 · 0 comments
Assignees

Comments

@rlodge
Copy link
Contributor

rlodge commented Feb 5, 2020

Given an object like this:

    public static class MockObject {
        @Id
        @ObjectId
        public String id;
        public Custom custom;
        public Map<URI, String> uriStringMap;
    }

and an update statement like this:

        coll.updateOne(
            Filters.eq(obj.id),
            Updates.combine(
                Updates.set("custom", obj.custom),
                Updates.set("uriStringMap", obj.uriStringMap)
            ),
            new UpdateOptions().upsert(true)
        );

The mongo driver will fail to find a useful mapping from URI to String because the map inside the $set clause isn't passed through Jackson, it's converted by the default Codecs.

Modify the JacksonCodecRegistry to use Jackson for more of the conversions

@rlodge rlodge self-assigned this Feb 5, 2020
@rlodge rlodge changed the title Complex objects in queries fail to convert Complex objects in queries or updates fail to convert Feb 5, 2020
rlodge added a commit that referenced this issue Feb 5, 2020
@rlodge rlodge closed this as completed Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant