Let say we have following model,
Base class
class Meeting
{
String title;
}
First derived class
class OfficialMeeting extends Meeting
{
int numberOfParticipants;
String meetingRoomName;
}
Second derived class
class Party extends Meeting
{
String theme;
}
Composition
class Schedule
{
List<Meeting> meetings;
}
When I try to search the collection 'schedules' having theme as "Beach Party", Spring data mongo errors out saying Meeting does not have a field called theme.
Please suggest a solution here in terms of model design or search to mongo collection.