Closed jeremos closed 5 months ago
Hi @jeremos , Thank you for the catch! Yup, python typing system, how pydantic uses it inside the Rust layer and what I can do with it is a complicated thing :) But yes, sure, I have to make Beanie be able to handle multilevel links. Thank you!
This issue is stale because it has been open 30 days with no activity.
This issue was closed because it has been stalled for 14 days with no activity.
Hi,
First, Many thanks for your work on Beanie. It's a great and powerful ODM :) I use Beanie with a large object model with many nested objects.
[A] : Link [B] [B] : List[BackLink [A] ] [B] : Link [C] [C] : List[BackLink [B] ] [C] : Link [D] ...
I noticed the object type is "lost" after the third level and the BackLink type (in my case) is affected to objects after this level. When objects have to be serialized, Pydantic does not know how to serialize the object :
pydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize unknown type: <class 'beanie.odm.fields.BackLink'>
The actual way to bypass the trouble is to add a pydantic "exclude=True" on fields.
I also read in the Beanie documentation that only the second level of Links/BackLinks are correctly managed for now. So when you will work on multi level Links/BackLinks, it will be appreciated to specify a max Depth level under which one Objects will not be fetched.
Thank again