You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm sure that the database was initialized properly because everything else works normally, only this fetch_links has problem. Just to be sure, here is how the database was initialized:
Describe the bug
AttributeError: get_motor_collection
when settingfetch_links=True
.To Reproduce
I'm using Beanie with FastAPI. For example, my Beanie models look like this:
When getting a
Project
by ID, I also want to prefetch its relateditems
. So, my endpoint looks like this:But I got the error:
If I remove
fetch_links=True
and later on callthen it works fine.
I'm sure that the database was initialized properly because everything else works normally, only this
fetch_links
has problem. Just to be sure, here is how the database was initialized:This function is then called in the startup part of FastAPI:
So, did I miss something? Or it's a bug of Beanie? I'm using FastAPI 0.115.2 and Beanie 1.27.0.
Expected behavior
Document.get(id, fetch_links=True)
should work without error.The text was updated successfully, but these errors were encountered: