mdocument.model.model.Model¶
-
class
mdocument.model.model.Model¶ Bases:
objectDocument model. Should be JSON serializable.
All class fields that are not a part of model but are needed for internals should be named with first underscore.
Document model should be set in Document class with Model name.
-
__init__()¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__()Initialize self.
add_relation(relation)Adds relation to global set of models relations.
fields()fields_dict()pop_optional_none(query)Pops optional fields with None values.
validate(document[, pre_insert])Validates that fields are present and have correct types.
-
classmethod
add_relation(relation: Relation)¶ Adds relation to global set of models relations.
-
classmethod
pop_optional_none(query: dict)¶ Pops optional fields with None values.
-
classmethod
validate(document: Union[MDocument, dict], pre_insert=False)¶ Validates that fields are present and have correct types.
-