We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa9d596 commit 04497aeCopy full SHA for 04497ae
mongoengine/fields.py
@@ -967,12 +967,12 @@ def to_mongo(self, document):
967
id_field = cls._fields[id_field_name]
968
969
id_ = id_field.to_mongo(id_)
970
- if self.dbref:
971
- collection = cls._get_collection_name()
972
- return DBRef(collection, id_)
973
- elif self.document_type._meta.get('abstract'):
+ if self.document_type._meta.get('abstract'):
974
collection = cls._get_collection_name()
975
return DBRef(collection, id_, cls=cls._class_name)
+ elif self.dbref:
+ collection = cls._get_collection_name()
+ return DBRef(collection, id_)
976
977
return id_
978
0 commit comments