Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-28-2021 07:15 AM
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?
All the sessions of the conference are now available online