Skip to content

Use typescript-mongodb plugin with TypeGraphQL #5393

Answered by dotansimha
Merlin04 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Merlin04 !
I'll start with a side note: the typescript-mongodb was an experiment we did a long time ago, aiming to use the GraphQL (API) layer as a place to declare the DB models. This was an idea, turned into an experiment.
My personal take is that you shouldn't mix your DB models and your APIs, since in most cases, these are different and have differences that are not minor.

Regarding your question: Since this codegen plugin is using custom directives, you need to add it to your runtime, since otherwise you'll get an error. These directives are declarative only, and they don't have any runtime effect, it's just for making the schema valid and loadable. The Codegen plugin for mongodb…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dotansimha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants