MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / document_type

Method document_type

mongoengine/fields.py:728–744  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

726
727 @property
728 def document_type(self):
729 if isinstance(self.document_type_obj, str):
730 if self.document_type_obj == RECURSIVE_REFERENCE_CONSTANT:
731 resolved_document_type = self.owner_document
732 else:
733 resolved_document_type = get_document(self.document_type_obj)
734
735 if not issubclass(resolved_document_type, EmbeddedDocument):
736 # Due to the late resolution of the document_type
737 # There is a chance that it won't be an EmbeddedDocument (#1661)
738 self.error(
739 "Invalid embedded document class provided to an "
740 "EmbeddedDocumentField"
741 )
742 self.document_type_obj = resolved_document_type
743
744 return self.document_type_obj
745
746 def to_python(self, value):
747 if not isinstance(value, self.document_type):

Callers

nothing calls this directly

Calls 2

get_documentFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected