MongoEngine / MongoEngine/mongoengine
Question about switch_collection
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4h 41m
- Merged PRs (30d)
- 11
Description
Hi,
I'm quite new to mongodb and mongoengine and particular. We're looking at developing a multi tenanted django application that uses a single database, while giving each client their own collections for each of our models, eg:
client_1_products
client_1_orders
client_2_products
client_2_orders
What we would like to be able to do is easily change the collection name based on the client that using the app (each client would be assigned a collection prefix on registration). I have looked at the switch_collection() function, but I'm not sure if it's the best way to go about this. The site will be used by hundreds of people at the same time, so from a performance perspective I need to ensure that this does not impact negatively.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The question centers on MongoEngine's switch_collection() in a multi-tenant Django application, but names no repository files or tests. Start by reviewing that entry point and its documented behavior under concurrent use; done would be a clear, documented recommendation for tenant-specific collections and the relevant performance or safety considerations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, python
- Domain
- backend, databases
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100