pydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize unknown type: <class 'bson.objectid.ObjectId'> #1194
Unanswered
js-d-coder
asked this question in
Question
Replies: 1 comment 1 reply
-
Do you still get the same error with the latest Beanie version? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am returning an object which I fetch from database using Beanie ODM and returning it in FastAPI API response and the error I get is this:
The code is something like this:
How do I fix this error in FastAPI? Apparently, Pydantic does not know how to serialize Beanie's
ObjectId
.Beanie version 1.30.0
Pydantic version 2.9.2
FastAPI version 0.115.13
Beta Was this translation helpful? Give feedback.
All reactions