Skip to content
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

add plural config make developer able to select the default collection name #115

Open
wasdee opened this issue Mar 9, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@wasdee
Copy link

wasdee commented Mar 9, 2021

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

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

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.

@wasdee wasdee added the enhancement New feature or request label Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant