0

我在以正确的方式创建关系时遇到问题,我有这些模式:

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)
}

我添加了这个突变来直接作为当前用户之一创建一顿饭,如下所示:

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
      """
    )
}

在 neo4j 数据库中,与用户建立了关系,一切看起来都很好,但是当我查询用户的饭菜或饭菜的 createdBy 字段时,它显示“null”,我错过了什么?

4

0 回答 0