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

Native Custom codec is not used for update #182

Closed
larslorenzen opened this issue Feb 28, 2020 · 5 comments
Closed

Native Custom codec is not used for update #182

larslorenzen opened this issue Feb 28, 2020 · 5 comments

Comments

@larslorenzen
Copy link

larslorenzen commented Feb 28, 2020

Hi, we added a custom codec for java.util.Currency.
But it seems like the codec is not used for updates.

my guess is that in the fun filterIdToBson a codecRegistry without my custom codec is used.

Or am i registering my codec the wrong way?

I've created a small test here: https://github.com/larslorenzen/kmongo-custom-codec/blob/master/src/test/kotlin/CustomCodecTest.kt

insert and find are working but Updating is throwing an error.

Expected outcome: all encoding and decoding operations use my custom codec.

Actual outcome: Only some operations use my custom codec

KMongo Version used: 3.12.1

@zigzago
Copy link
Member

zigzago commented Mar 1, 2020

Thank you for reporting. This is a bug. KMongoCodecProvider was an attempt to fix it, but I will commit today a more reliable fix.

@zigzago
Copy link
Member

zigzago commented Mar 1, 2020

The fix is in the snapshot. Use ObjectMappingConfiguration.addCustomCodec to register a custom codec

@zigzago zigzago closed this as completed in bc7cecd Mar 1, 2020
@larslorenzen
Copy link
Author

Awesome, thank you very much.

Any ETA for a 3.12.2 including the fix? :)

@zigzago
Copy link
Member

zigzago commented Mar 2, 2020

There will be a new kmongo version when a new version of the mongo java driver will be released. look at https://jira.mongodb.org/projects/JAVA?selectedItem=com.atlassian.jira.jira-projects-plugin%3Arelease-page&status=released-unreleased ;)

@larslorenzen
Copy link
Author

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

2 participants