cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in merging two schema result

I want to merge two schema result.Since Graphql does not make the merge statement for me. I have tried to make it myself but when i am trying to merge it is giving me null value ...

query{
  users {
    id
    User_ID
    Name
    settings {
      User_ID
      Auto_Check_In
    }
  }
}

output:

{
  "data": {
    "users": [
      {
        "id": "0.55515894979673",
        "User_ID": "2",
        "Name": "kp",
        "settings": null
      }
    ]
  }
}

Here is my schema

 type User    {
  id:ID!
  User_ID:String!
  Mobile_Number:String!
  Name:String!
  Email_Id:String!
  settings: [Settings] 
}
   
type  Settings {
  id:ID!
  User_ID:String!
  Auto_Check_In:String!
  Notification:String!
}
 
type RootMutation {
  createdByUser(userInput:UserInput):User!     
}
1 REPLY 1

William_Lyon
Graph Fellow

You should use the @relation directive in your schema to define the relationship connecting User and Settings:

type User {
  id: ID!
  UserID: String!
  Name: String!
  Email_Id: String!
  settings: [Settings] @relation(name: "HAS_SETTINGS", direction: "OUT")
}

See the docs for more info: https://grandstack.io/docs/graphql-relationship-types.html#defining-relationships-in-sdl

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.