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

How to add a default codec for internal objects of an entity #3181

Open
victorGS18 opened this issue Aug 8, 2024 · 1 comment
Open

How to add a default codec for internal objects of an entity #3181

victorGS18 opened this issue Aug 8, 2024 · 1 comment
Labels

Comments

@victorGS18
Copy link

I'm having problems reading an object that has another object defined inside. It tells me that it doesn't find a codec and therefore I would like to add a default pojoCodec as is possible in the driver.

The codecRegistry would be this:
MongoClientSettings.getDefaultCodecRegistry(), CodecRegistries.fromProviders(PojoCodecProvider.builder().automatic(true).build())

The problem is that if I add this to MapperOptions then it adds them before the Morphia Codecs and then the aggregations don't work, for example, the $match expression decodes it with the default codec.

Is there a way to do this?
Or what is the solution for internal objects of an entity?

Thanks!

** Please complete the following information: **
Morphia Version: 2.4.14

@victorGS18
Copy link
Author

victorGS18 commented Aug 8, 2024

What I want is to avoid having to annotate 300 internal classes with @Entity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant