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

Method to_mongo

mongoengine/fields.py:2616–2633  ·  view source on GitHub ↗
(self, document)

Source from the content-addressed store, hash-verified

2614 return super().validate(value)
2615
2616 def to_mongo(self, document):
2617 if document is None:
2618 return None
2619
2620 if isinstance(document, LazyReference):
2621 return SON(
2622 (
2623 ("_cls", document.document_type._class_name),
2624 (
2625 "_ref",
2626 DBRef(
2627 document.document_type._get_collection_name(), document.pk
2628 ),
2629 ),
2630 )
2631 )
2632 else:
2633 return super().to_mongo(document)
2634
2635
2636class Decimal128Field(BaseField):

Callers

nothing calls this directly

Calls 2

_get_collection_nameMethod · 0.45
to_mongoMethod · 0.45

Tested by

no test coverage detected