-
Notifications
You must be signed in to change notification settings - Fork 1.2k
None of the switch_db or switch_collection support is thread-safe #2685
New issue
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
Comments
nzjess
pushed a commit
to nzjess/mongoengine
that referenced
this issue
Aug 19, 2022
nzjess
pushed a commit
to nzjess/mongoengine
that referenced
this issue
Aug 19, 2022
nzjess
pushed a commit
to nzjess/mongoengine
that referenced
this issue
Aug 30, 2022
nzjess
pushed a commit
to nzjess/mongoengine
that referenced
this issue
Aug 30, 2022
nzjess
pushed a commit
to nzjess/mongoengine
that referenced
this issue
Sep 3, 2022
…hat can be different per thread
nzjess
pushed a commit
to nzjess/mongoengine
that referenced
this issue
Sep 3, 2022
…hat can be different per thread
nzjess
pushed a commit
to nzjess/mongoengine
that referenced
this issue
Sep 23, 2022
nzjess
pushed a commit
to nzjess/mongoengine
that referenced
this issue
Sep 23, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As per this long standing issue: #788
It seems the original intent of these switching mechanisms was to support archiving or similar use-cases.
However, more generally, I may just have a document model that I want to use against many different Mongo databases (all of which contain data for the same model) but all within the same Python process, and all concurrently (eg. if my application is a multi-user service). Ultimately, the name of the database to use for any given call into the system could even be completely dynamic, i.e. driven by user inputs to the system itself.
To support this, we need to use thread locals.
The text was updated successfully, but these errors were encountered: