-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Many to Many relation through joint table returns null value #1569
Closed
vOtto opened this issue
Aug 24, 2018
· 6 comments
· May be fixed by k4ny/apollo-server#3 or penx/apollo-server#6
Closed
Many to Many relation through joint table returns null value #1569
vOtto opened this issue
Aug 24, 2018
· 6 comments
· May be fixed by k4ny/apollo-server#3 or penx/apollo-server#6
Comments
Can you post your resolver code? Just for future reference, this is a question better suited for Stack Overflow! |
Updated. |
On your post type, what does the resolver look like for the category field? |
I think thats the issue, cause i have none. |
thanks alot |
No problem! You should be able to just return root.categories, whatever the db field is called |
This was referenced Apr 27, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have my model many to many relation in my model:
Posts have many categories and categories might have many posts type Post
and
through a PostCategories table.
create mutation works just fine.
but when I try to Query categories on posts im getting null as result, query:
and result:
updated:
resolver for category
Query: { category(root, id) { return db.category.findOne({ id }).then(collection => collection.dataValues); }, },
and for post
Query: { post(root, { id }) { return db.post.findOne({ id }).then(collection => collection.dataValues); },
any ideas?
The text was updated successfully, but these errors were encountered: