Convert a MongoDB-compatible type to a Python type.
(self, value)
| 2500 | return pk |
| 2501 | |
| 2502 | def to_python(self, value): |
| 2503 | """Convert a MongoDB-compatible type to a Python type.""" |
| 2504 | if not isinstance(value, (DBRef, Document, EmbeddedDocument)): |
| 2505 | collection = self.document_type._get_collection_name() |
| 2506 | value = DBRef(collection, self.document_type.id.to_python(value)) |
| 2507 | value = self.build_lazyref(value) |
| 2508 | return value |
| 2509 | |
| 2510 | def validate(self, value): |
| 2511 | if isinstance(value, LazyReference): |
nothing calls this directly
no test coverage detected