Skip to content

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

Open
jessemcl-flwls opened this issue Aug 19, 2022 · 0 comments
Open

Comments

@jessemcl-flwls
Copy link

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.

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
nzjess pushed a commit to nzjess/mongoengine that referenced this issue Sep 3, 2022
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant