Code Gen TS Resolvers & TS MongoDB #6923
Unanswered
alexsserban
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I really enjoy using graphql code generator a lot, but after trying to integrate the MongoDB plugin I have a question regarding how this one should be used.
So in my Graphql TypeDefs I have a User. Code Gen TS Resolvers plugin generates for me the TS type and also forces my query (user(_id: ID!): User!) to return a graphql typed User.
Code Gen MongoDB generates for me UserDbObject, which obviously has an _id of type ObjectId, compared to the other one which is ID!
The question is this: In my user query I use the MongoDB driver to get the user from the DB, and that user is of type UserDbObject, but I am unable to return it in my resolver because the resolver expects to get a User type... the difference between those types being the type of the _id field. So isn't this the right approach? Should I view the situation differently?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions