Open ADR-007 opened 2 months ago
Hi, thank you for the report.
How would you know which Document to update? Just this one, the other, all of them? Beanie treats Document classes as their own separate Document instances in the DB, along with the collection they belong to. Also I'm having trouble to understand which action would you like to be possible / what API. Could you give some usage examples, along with the expected outcome(s)?
You can use Pydantic models (that inherit from BaseModel) for the 'base classes'/models that you have, and then inherit from those for your Document's.
This issue is stale because it has been open 30 days with no activity.
Describe the bug
Models that have more than 1 base class on top level are skipped during the initialization, so they cannot be used for any query.
To Reproduce
Error
``` _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .venv/lib/python3.12/site-packages/beanie/odm/actions.py:239: in wrapper result = await f( .venv/lib/python3.12/site-packages/beanie/odm/utils/state.py:85: in wrapper result = await f(self, *args, **kwargs) .venv/lib/python3.12/site-packages/beanie/odm/utils/self_validation.py:19: in wrapper return await f(self, *args, **kwargs) .venv/lib/python3.12/site-packages/beanie/odm/documents.py:611: in save return await self.update( .venv/lib/python3.12/site-packages/beanie/odm/actions.py:239: in wrapper result = await f( .venv/lib/python3.12/site-packages/beanie/odm/utils/state.py:85: in wrapper result = await f(self, *args, **kwargs) .venv/lib/python3.12/site-packages/beanie/odm/documents.py:728: in update result = await self.find_one(find_query).update( .venv/lib/python3.12/site-packages/beanie/odm/queries/update.py:351: in __await__ update_result = yield from self._update().__await__() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self =Expected behavior Document is saved as it happens when there is just a single base class
Additional context
Source of the problem: beanie/odm/utils/init.py: