I'm new to MongoDB and am trying to design a simple schema for a set of python objects. I'm having a tough time working with the concept of polymorphism.
Below is some pseudo-code. How would you represent this inheritance hierarchy in MongoDB schema:
class A:
content = 'video' or 'image' or 'music'
data = contentData # where content may be video or image or music depending on content.
class videoData:
length = *
director = *
actors = *
class imageData:
dimensions = *
class musicData:
genre = *
The problem I'm facing is that the schema of A.data depends on A.content. How can A be represented in a mongodb schema?