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
I have an Optional EmbeddedModel inside my main model. If I don't set a value for it, when the engine tries to save the data in the database, I get the error: TypeError: 'NoneType' object is not iterable
Current Behavior
This is a basic example that shows this behavior (it's the same with the AIOEngine):
from odmantic import Model, EmbeddedModel, SyncEngine
class Profile(EmbeddedModel):
name: str
age: int
class User(Model):
username: str
password: str
profile: Profile | None
engine = SyncEngine()
user = User(username="John", password="password")
engine.save(user)
Expected behavior
The engine should save the model even if the EmbeddedModel is initially not set.
Environment
ODMantic version: 0.9.0
MongoDB version: 6.0.1
Pydantic infos (output of python -c "import pydantic.utils; print(pydantic.utils.version_info())):
Bug
I have an Optional EmbeddedModel inside my main model. If I don't set a value for it, when the engine tries to save the data in the database, I get the error:
TypeError: 'NoneType' object is not iterable
Current Behavior
This is a basic example that shows this behavior (it's the same with the AIOEngine):
Expected behavior
The engine should save the model even if the EmbeddedModel is initially not set.
Environment
python -c "import pydantic.utils; print(pydantic.utils.version_info())
):The text was updated successfully, but these errors were encountered: