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
Describe the bug A comment in #536 gives an example of using database sessions and transactions with beanie. However, when one wants to factor out the session into a separate function and annotates it, it does not properly type check using mypy anymore.
Interestingly, this is not the case for all Document methods, despite beanie annotating session as pymongo.client_session.ClientSession everywhere.
I'd be glad to create a PR if the issue is really only to replace pymongo.client_session.ClientSession with motor.motor_asyncio.AsyncIOMotorClientSession, and would have a look in any other hints you can give for a fix.
Note that just casting the session to a pymongoClientSession does not work since its start_session method is no coroutine.
Describe the bug
A comment in #536 gives an example of using database sessions and transactions with
beanie
. However, when one wants to factor out the session into a separate function and annotates it, it does not properly type check usingmypy
anymore.Interestingly, this is not the case for all
Document
methods, despitebeanie
annotatingsession
aspymongo.client_session.ClientSession
everywhere.I'd be glad to create a PR if the issue is really only to replace
pymongo.client_session.ClientSession
withmotor.motor_asyncio.AsyncIOMotorClientSession
, and would have a look in any other hints you can give for a fix.Note that just casting the session to a
pymongo
ClientSession
does not work since itsstart_session
method is no coroutine.To Reproduce
Current behavior
mypy
shows an error forfind()
(but not forinsert()
):Expected behavior
Code type checks using
mypy
Additional context
none
The text was updated successfully, but these errors were encountered: