Mongo collections can contain documents of different shapes. Polymorphic models implement support for having multiple models in one collection. This comes with the following restrictions:
The Collection name must be declared on the “root” polymorphic model.
Each document has a “_type” associated with it that contains the model class name. By enabling the option “qualified_names” the full qualified class names will be used.
On instantiation the Model tries to create an instance of the respective type (by checking its known subclasses). If no such type exists an error is raised.
It is an error to mark a submodel of a polymorphic model as polymorphic as well.
Polymorphic models and abstract models can be combined.
Mongo collections can contain documents of different shapes. Polymorphic models implement support for having multiple models in one collection. This comes with the following restrictions:
Polymorphic models and abstract models can be combined.