cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Relationship IN and OUT not working as expected with cypher in graphql/neo4j

I'm having an issue creating a relationship the right way, I have these schemas :

type User {
  id: ID!
  mail: String!
  password: String! @private
  meals: [Meal] @relationship(type: "IN_MEALS", direction: IN)
}

type Meal {
  name: String!
  createdBy: User! @relationship(type: "IN_MEALS", direction: OUT)
}

And I added this mutation to create a meal directly as one of the current user's like so :

type Mutation {
  createMeal(name: String!): Meal
    @cypher(
      statement: """
      MATCH (u:User {id: $auth.jwt.id})
      MERGE (m:Meal {name: $name})-[r:IN_MEALS]->(u)
      RETURN m
      """
    )
}

In neo4j databse the relation is made to the user and all seems good but when I query meals of the users or the createdBy field of a meal it shows "null", what am I missing?

0 REPLIES 0