I want to store different data to one collection in MongoDb and have Spring data beans with appropriate field..
Sorry, I've skipped details.
Parent bean:
class A
int a
Childs:
class B extends A
double b
class C extends A
String c
So, there is following document in mongo
{a : 1, b : 2.3, c : "Test"}
When I fetch data, it is ok. But, when I call save method from CrudRepository for B, it rewrites all data and I lose C.
I know only one good option to create custom save method with incremental updates, such as
update.set("b", newvalue)...
but with reflection.
Do you have any other ideas?
Thanks in advance.