BeanieODM / beanie

Asynchronous Python ODM for MongoDB
http://beanie-odm.dev/
Apache License 2.0
1.94k stars 203 forks source link

Handle annotated indexes #762

Closed MrEarle closed 8 months ago

MrEarle commented 9 months ago

This PR aims to introduce a way to declare indexed fields using python's Annotated, extending the current use of Indexed. It implements the syntax proposed in https://github.com/roman-right/beanie/issues/638.

It also supports the use of UUID and EmailStr when using Pydantic 2 and Annotated. Kinda solving https://github.com/roman-right/beanie/issues/701, though I couldn't reproduce the issue with PydanticObjectId.

roman-right commented 8 months ago

Thank you for the PR! Merged. It will be published tomorrow

smeggingsmegger commented 8 months ago

Is this applied to Bunnet as well?