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

时间:2018-03-20 18:32:42

标签: graphql arangodb

我使用ArangoDB FOXX GraphQL Example从几个集合中检索数据(每个集合的名称与类型相同)。当我想使用_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是here

0 个答案:

没有答案