Using fetch_link, count is always 0. #398
-
Using How to solve this problem please? class Door(Document):
height: int = 2
width: int = 1
class House(Document):
door: Link[Door]
door1 = Door(height=100, width=200)
await door1.create()
door2 = Door(height=300, width=400)
await door2.create()
await House.insert_many([
House(door=door1),
House(door=door2),
])
print(await House.find(House.door.id == PydanticObjectId(...)).count())
# count is 1
print(await House.find(House.door.id == PydanticObjectId(...)).to_list())
# list is [House(..., door=Door(..., height=100, width=200))]
print(await House.find(House.door.id == PydanticObjectId(...), fetch_links=True).count())
# count is 0
print(await House.find(House.door.height == 100, fetch_links=True).count())
# count is 0
print(await House.find(House.door.height == 100, fetch_links=True).to_list())
# list is [House(..., door=Door(..., height=100, width=200))] |
Beta Was this translation helpful? Give feedback.
Answered by
roman-right
Nov 7, 2022
Replies: 1 comment
-
Hm. It looks like a bug. Thank you |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
hgalytoby
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hm. It looks like a bug. Thank you