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
Originally posted by chabErch August 11, 2022 Hi ❤️!
I have the department model:
department
class Department(Document): name: str parent: Optional[Link['Department']] = None
And I want to get all the documents with parent == None:
parent == None
departments = await Department.find(Department.parent == None, fetch_links=True).to_list()
And I get an error:
... departments = await Department.find(Department.parent == None, fetch_links=True).to_list() File "/usr/local/lib/python3.9/site-packages/beanie/odm/queries/cursor.py", line 69, in to_list cursor = self.motor_cursor File "/usr/local/lib/python3.9/site-packages/beanie/odm/queries/find.py", line 595, in motor_cursor self.find_expressions[i] = convert_ids( File "/usr/local/lib/python3.9/site-packages/beanie/odm/utils/relations.py", line 61, in convert_ids and k.split(".")[1] == "id"
Do I miss something?
The text was updated successfully, but these errors were encountered:
Hi, @chabErch Sorry for the delay. Could you please check if this is still reproducible?
I run this and it works:
import asyncio from typing import Optional from motor.motor_asyncio import AsyncIOMotorClient from beanie import Document, Link, init_beanie class Department(Document): name: str parent: Optional[Link['Department']] = None async def main(): client = AsyncIOMotorClient("mongodb://beanie:beanie@localhost:27017") await init_beanie(database=client.test, document_models=[Department]) await Department(name="A").save() departments = await Department.find(Department.parent == None, fetch_links=True).to_list() print(departments) asyncio.run(main())
Sorry, something went wrong.
Yes, it works! I didn't even notice when everything got fixed.
Thank you ❤️!
roman-right
No branches or pull requests
Discussed in #328
Originally posted by chabErch August 11, 2022
Hi ❤️!
I have the
department
model:And I want to get all the documents with
parent == None
:And I get an error:
Do I miss something?
The text was updated successfully, but these errors were encountered: