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
Change default Mongo UUID representation to STANDARD/v4 (Criteria) #1482
base: master
Are you sure you want to change the base?
Change default Mongo UUID representation to STANDARD/v4 (Criteria) #1482
Conversation
I noticed that |
2152293
to
06cf38f
Compare
Is this change backwards compatible? I does change the default UUID representation from Looking at UuidCodec decoding can be done with either formats so technically it may work. I'm just worried that UUIDs will be stored if multiple formats (unless all of them are rewritten). |
I wonder if we can expose directly ctor |
Perhaps you can also try the following: CodecRegistry registry = JacksonCodecs.registryFromMapper(mapper); // or some other way to instantiate registry
registry = CodecRegistries.withUuidRepresentation(registry, UuidRepresentation.STANDARD); |
I just tried this and it didn't have any effect.
I think that would be a good idea, at least it is something that can be done immediately without breaking anything. In the long run (perhaps for the next major release) I would suggest removing the hard-coded LEGACY flag and just using whatever the current default of the Mongo driver is.
It is backward compatible if you are using a v4 Mongo driver. New records will be written with v4 whereas the old ones will remain on v3. The switch to v4 might cause issues for applications that share their database with other applications that might use older drivers without support for v4 encoding. |
I just had a look at this again and there seem to be only two relevant places where the
Unfortunately, the first one takes precedence for encoding properties (and hence is causing the issue). Imho, the configuration of the codec should be left to the driver (which in turn can be configured by the user). The Spring Boot project for example configures the driver to use To summarize, I believe the hard-coded configuration of the legacy codec should be removed and the default no-arg constructor should be used instead. |
No description provided.