create-graphql
create-graphql copied to clipboard
Create a mongoose schema when generating a new type
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
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?
what would be the fields of this model?
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)?
@lucasbento he wants to create the UserModel in mongoose as well when creating an UserType if UserModel does not exist