We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug MongoDB natively supports UUIDs as object IDs (see https://stackoverflow.com/questions/28895067/using-uuids-instead-of-objectids-in-mongodb). However when using Document.inspect_collection with ids that are UUIDs, it gives an error:
TypeError: id must be an instance of (bytes, str, ObjectId), not <class 'uuid.UUID'>
To Reproduce
from beanie import Document from pydantic import UUID4 class MyCol(Document): _id: UUID4
The text was updated successfully, but these errors were encountered:
Fix is very simple - just add a union type in InspectionError in odm/models.py
odm/models.py
class InspectionError(BaseModel): """ Inspection error details """ document_id: PydanticObjectId | UUID4 error: str
Sorry, something went wrong.
Thank you for the catch.
Successfully merging a pull request may close this issue.
Describe the bug
MongoDB natively supports UUIDs as object IDs (see https://stackoverflow.com/questions/28895067/using-uuids-instead-of-objectids-in-mongodb). However when using Document.inspect_collection with ids that are UUIDs, it gives an error:
To Reproduce
The text was updated successfully, but these errors were encountered: