Closed dedeswim closed 8 months ago
It seems to be related to (if not the same as) #701. Feel free to close if it is actually the same.
Hi! Thank you for the issue, I'll check it during the next bug-fixing session next week.
Fixed by #762 if using Annotated
. The following now runs:
from typing import Annotated
from beanie import Document, Indexed, Link
class DocumentA(Document):
...
class DocumentB(Document):
a: Annotated[Link[DocumentA], Indexed(unique=True)]
Describe the bug I would like to have a
Link
inside of a document, but I also want it to be unique, for which (in my understanding), I needIndexed
. However, if I try that, I get an exception as below.To Reproduce
Expected behavior
The code should run without issues, however, I get the following exception:
Show exception
``` Traceback (most recent call last): File "/Users/edoardo/Library/Application Support/JetBrains/PyCharm2023.2/scratches/scratch.py", line 8, inAll the exceptions seem to be happening in Pydantic, but it I guess this is happening because of how Indexed is created?
Additional context
I am on
beanie==1.23.1
andpydantic==2.4.2
, the latest version for both.It looks like this should've been fixed by #754 but apparently it is not?