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

Method to_python

mongoengine/fields.py:1246–1253  ·  view source on GitHub ↗

Convert a MongoDB-compatible type to a Python type.

(self, value)

Source from the content-addressed store, hash-verified

1244 return id_
1245
1246 def to_python(self, value):
1247 """Convert a MongoDB-compatible type to a Python type."""
1248 if not self.dbref and not isinstance(
1249 value, (DBRef, Document, EmbeddedDocument)
1250 ):
1251 collection = self.document_type._get_collection_name()
1252 value = DBRef(collection, self.document_type.id.to_python(value))
1253 return value
1254
1255 def prepare_query_value(self, op, value):
1256 if value is None:

Callers

nothing calls this directly

Calls 2

_get_collection_nameMethod · 0.45
to_pythonMethod · 0.45

Tested by

no test coverage detected