You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In one of the models, I create a reference to another model. When I try to validate the received document using “model_validate_doc”, I get the error “AttributeError: ‘ObjectId’ object has no attribute ‘get’”.
> Customer.model_validate_doc(customer.model_dump_doc())
> File ".venv\Lib\site-packages\odmantic\model.py", line 795, in model_validate_doc
> errors, obj = cls._parse_doc_to_obj(raw_doc)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File ".venv\Lib\site-packages\odmantic\model.py", line 830, in _parse_doc_to_obj
> sub_errors, sub_obj = field.model._parse_doc_to_obj(
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File ".venv\Lib\site-packages\odmantic\model.py", line 910, in _parse_doc_to_obj
> value = raw_doc.get(field.key_name, Undefined)
> ^^^^^^^^^^^
> AttributeError: 'ObjectId' object has no attribute 'get'
In one of the models, I create a reference to another model. When I try to validate the received document using
“model_validate_doc”
, I get the error“AttributeError: ‘ObjectId’ object has no attribute ‘get’”
.The text was updated successfully, but these errors were encountered: