Closed jbkoh closed 3 years ago
I just found https://github.com/Scille/umongo/blob/96abcff8586bc30014338ebdd52f97cd12b671f7/umongo/fields.py#L319, so it seems to be an expected behavior. Is there any plan to make it more generic?
I looked through the code a bit and thought we could let Document to have other types than ObjectId as pk types. Maybe I'm wrong. Let me know if it's something worth investigating. Thanks!
Document
s may have other types than ObjectId
for id but there is a bug preventing them from being used in a ReferenceField
.
This is a known issue. Closing this to let the discussion take place in #116.
Hi again,
I have a Document whose ids are string. I would like to let another Document to Reference it like the following:
However the last line gives me an error
marshmallow.exceptions.ValidationError: Invalid ObjectId
.I was actually expecting ReferenceField's field to receive the document instances asthe argument (i.e.,
BBB(aaa=aaa_instance)
), but umongo seems to interpret ReferenceField as ObjectIdField.Is it an expected behavior or a bug? Thanks!