Posts

Showing posts with the label relation between graphql objects

Creating relation between two Object Types in GraphQL using Node JS

Image
Hello everyone, in this article we are going to look at how we can create relations between two object types in GraphQL. This is the second part of GraphQL with Node, MongoDB and React series If you have missed the first part here is the link :  Set up graphQL backend using Node.js, express and mongoDB - Step by Step Reading the above article is important as we are going to use the same example and and continue code from where we left there. Ok until last time we have created two object types Game and Publisher.  Game has field like id,name, genre and publisher has fields id, name and established. Now lets refer the diagram once again As you can see each game has a publisher. So we need to link Game type with PublisherType for that to happen we need to add a key to each game data which will hold reference for it's Publisher Ok so let's modify the dummy data array for Games const games = [ { name: "FIFA" , id: "1...