-
Notifications
You must be signed in to change notification settings - Fork 889
Description
Hi scott , my name is rakshith and i had attended your server side graphql in nodejs online course on frontend masters. I had this doubt on resolvers.
There are 2 object types -
User { email , name, post : Post}
Post {body, user: User }
I have 2 mutations - addPost and deletePost
I have written a resolver to addPost , basically it creates a new post in collection. Then i used the type resolver user from post type to fetch user data.
Now in the 2 mutation deletePost . I have written a resolver to delete a post using the id, and i am then trying to use the type resolver from post type that is user to remove the reference of tht post from the user.
The problem here is.. the type resolver user is already fetching me a user data for the earlier addPost mutation. How will i tell it to only run a query that would delete the reference from the user, and not fetch a user?