如何使用 GraphQL 检索 ArangoDB 集合中的所有项目

问题描述 投票:0回答:1

我正在使用 ArangoDB FOXX GraphQL 示例 从几个集合中检索数据(每个集合的名称与类型相同)。当我想使用 _key 属性检索一项时,一切都很好,但是当我尝试检索集合中的所有项时(请参阅diagnosticItems),我收到错误。我的架构定义是:

export const typeDefs = [`
enum Status {
  up
  down
}

type DiagnosticItem {
  _key: String!
  title: String!
  status: Status
  locationKey: String
  lastUpdatedDate: String

  location: Location @aql(exec: "FOR location in Location filter location._key == @current.locationKey return location")
}

type Location {
  _key: String!
  title: String!
}

type Query {
  diagnosticItem(_key: String!): DiagnosticItem
  diagnosticItems: [DiagnosticItem]
  location(_key: String!): Location
}
`];

完整的 StackBlitz 在这里

graphql arangodb
1个回答
0
投票

你成功了吗?我也面临同样的问题。

© www.soinside.com 2019 - 2024. All rights reserved.