node.js - GraphQL Mutation 使用 neo4j-graphql-js 从 Neo4j 数据库返回 Null
问题描述
我有一个突变,旨在创建汽车并将汽车分配给所有者。我使用 Neo4j 作为底层数据库,所以我cypher
像这样在我的 Graphql 模式文件中扩展指令
CreateCar(data: CarInput!): Car!
@cypher(
statement: """
MERGE(s:Car {name: $data.name})
ON CREATE
SET s.id = apoc.create.uuid(), s.name = $data.name, s.description = $data.description, s.category = $data.category,
WITH s
MATCH(o:Owner {id: $cypherParams.currentUserId})
MERGE(o)-[:OWNS]->(s)
RETURN s
"""
)
当我在我的 Graphql Playground 中运行上述突变时,当数据插入数据库时,突变成功运行,但我从 Playground 得到回复,说"message": "Cannot return null for non-nullable field Mutation.CreateCar."
我也使用 Neo4J Browser 尝试了相同的查询并且它可以工作,但是运行突变,数据不会返回。任何帮助将不胜感激,非常感谢。
解决方案
推荐阅读
- javascript - 使用 Google Cloud Functions Node.JS 等待多个异步函数的正确方法
- r - R:更新悬停文本
- python - 为什么我的脚本逐渐变慢?
- python - 重新索引的 Pandas 自定义 ExtensionDtype 排序问题
- c# - “.NET CLR 内存类别”PerformanceCounters 是确定堆大小的唯一方法吗?
- c++ - 我应该从上次读取时将相同的提取字符传递给 std::cin.putback() 吗?
- spring-boot - 无法启动组件 [StandardEngine[Catalina].StandardHost[localhost].StandardContext - Tomcat 9
- r - 在dfm对象R中分隔字符
- javascript - 用Ajax以数组格式提交表单,不序列化?
- python - TypeError:无法腌制“_thread.lock”对象 Dask 计算