I followed the doc to create a relationship, but it doesn't work #954
Unanswered
tanguynicolas
asked this question in
Question
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm starting with Beanie. I create an API with FastAPI and MongoDB.
Here's the code, which I've simplified for you, that doesn't work. I've (I think) done exactly what the official documentation says. I don't understand why it can't work:
In fact, uvicorn runs successfully, but when I launch the Swagger UI, I get an error. This is due to my relationship between Team and Player, because when I remove it, everything works (or when I remove
team: Team
fromcreate_team(team: Team)
).My versions:
fastapi 0.111.0
pydantic 2.7.1
motor 3.4.0
beanie 1.26.0
uvicorn 0.29.0
I'm sure it's a simple mistake, but unfortunately I can't figure it out. A more experienced eye could help me.
Thank you
Bonus: if you see things to improve in my code, don't hesitate, it will be very instructive for me!
Beta Was this translation helpful? Give feedback.
All reactions