Returns an instance of :class:`~bson.dbref.DBRef` useful in `__raw__` queries.
(self)
| 829 | return value |
| 830 | |
| 831 | def to_dbref(self): |
| 832 | """Returns an instance of :class:`~bson.dbref.DBRef` useful in |
| 833 | `__raw__` queries.""" |
| 834 | if self.pk is None: |
| 835 | msg = "Only saved documents can have a valid dbref" |
| 836 | raise OperationError(msg) |
| 837 | return DBRef(self.__class__._get_collection_name(), self.pk) |
| 838 | |
| 839 | @classmethod |
| 840 | def register_delete_rule(cls, document_cls, field_name, rule): |