mdocument.model.field.FieldRelated

class mdocument.model.field.FieldRelated(document_cls: Type[MDocument], optional: bool = False, relation: Type[Relation] = None, unique: bool = False)

Bases: mdocument.model.field.Field

Field where its value is a primary key value of a specific document.

__init__(document_cls: Type[MDocument], optional: bool = False, relation: Type[Relation] = None, unique: bool = False)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(document_cls[, optional, relation, …])

Initialize self.

connect_to_model(model, name)

Saves field model relation.

to_dict()

validate(value)

Validates that value matches related documents primary key type.

Attributes

SENSITIVE_PLACEHOLDER

is_primary

is_related

connect_to_model(model: Type[Model], name: str)

Saves field model relation.

validate(value)

Validates that value matches related documents primary key type.