I read the MongoDB documentation and Spring adds the _class field to the default saved data. Is there any way to use this information for type inference?
For example: there is an abstract class Animal with three subclasses Dog, Cat, Bird. Say you have a cool zoo that contains a list of animals. In the database, you store these Zoo objects. Is there any function to get the List<Animal> back with animals that can be increased?
I use Spring , so I prefer to have a solution that will work using spring-data-mongodb . But an external mapping library will be wonderful too. I prefer not to write it myself, as it looks like a basic display function.
source share