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

Create a mongoose schema when generating a new type #38

Open
farazcsk-zz opened this issue Dec 30, 2016 · 4 comments
Open

Create a mongoose schema when generating a new type #38

farazcsk-zz opened this issue Dec 30, 2016 · 4 comments

Comments

@farazcsk-zz
Copy link

I can see that it is possible to create a graphql type or mutation based on an existing mongoose schema using the --schema command, it would be great if creating a model without an existing mongoose schema could generate one.

For example the command:

create-graphql generate -tm User

Generates:

./src/model/User.js

@farazcsk-zz farazcsk-zz changed the title Create a mongoose model when generating a new type Create a mongoose schema when generating a new type Dec 30, 2016
@lucasbento
Copy link
Collaborator

Looks good, haven't thought about it because I never had a use case for doing so.

Would you mind sharing your use case to come up with that idea?

@sibelius
Copy link
Collaborator

what would be the fields of this model?

@lucasbento
Copy link
Collaborator

Humm, I think I got it now.

Are you looking for a command to generate an empty model as we currently do on type without schema (here)?

@sibelius
Copy link
Collaborator

@lucasbento he wants to create the UserModel in mongoose as well when creating an UserType if UserModel does not exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants