add plural config make developer able to select the default collection name
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
I want to reach out the author of repo and check his opinion about a new feature.
## currently
this lib will use the lowercase class name as the default name in mongodb
```python
class User(Model):
name: str
```
Save this with `engine` and it will generate the collection `user` in mongodb
I also know that the lib provide a way to set custom collection name.
## propose
I want a lazy solution to just turn my class name into plural nouns and use that.
I want instead of `user`, I would like to go by the `users` without me need to specify all custom names by myself.
I know there is workaround, but i think it is nice to have this as a lib option directly.
There are many choices of interfaces that could potentially be, for example
```python
class CapitalCity(PluralMixins, Model):
pass
class CapitalCity(ModelWithPluralName):
pass
engine = AIOEngine(use_plural_collection_name=True)
```
I trusts in the pythonic instrict of author. so, I'm waiting for reply.
## how to implement
Maybe we can use this lib to help in plural conversion https://pypi.org/project/inflect/
I could do a PR.
Contributor guide
Research direction
The issue names Model, AIOEngine(use_plural_collection_name=True), and the optional inflect library; begin by tracing how the engine derives a default MongoDB collection name. A decision is still needed on the public API and pluralization behavior; done means the chosen option maps examples such as User to users without requiring per-model names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, python
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100