BeanieODM / beanie

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

[BUG] Indexed unique will not work after Field regex. #919

Closed hgalytoby closed 4 months ago

hgalytoby commented 5 months ago

Describe the bug Indexed unique will not work after Field regex.

To Reproduce

not work

class RegexTest(Document):
    val: Indexed(str, unique=True) = Field(regex=r"^[a-zA-Z0-9]+$")

await RegexTest(val='123').create()
await RegexTest(val='123').create()

work

class RegexTest(Document):
    val: Indexed(str, unique=True) = Field()

await RegexTest(val='123').create()
await RegexTest(val='123').create()
github-actions[bot] commented 4 months ago

This issue is stale because it has been open 30 days with no activity.

github-actions[bot] commented 4 months ago

This issue was closed because it has been stalled for 14 days with no activity.