简体   繁体   中英

How do I suppose to do to return a relation type with custom query in neo4j graphql js

So I have a schema like this:

type NetZone {
  name: String
  version: String
  hasAccessTo: [HasAccess]
}

type HasAccess @relation(name: "HasAccess") {
from: NetZone
to: NetZone
version: String
}

So there is a "HasAccess" connect to "NetZone" itself, and that cause unexpected generated querties, like, totally unacceptable result, so I change to use custom query, and change type NetZone to something like this:

type NetZone {
  name: String
  version: String
  hasAccessTo(first: Int = 10, offset: Int = 0): [NetZone] @cypher(statement: "MATCH (this)-[r:HasAccess]->(target:NetZone) RETURN target SKIP $offset LIMIT $first")
}

So now it is working. But I really want to return something like this:

type _HasAccess {
  version: String
  netZone: NetZone
}

is there any way to achieve this, or a way to fix the first unexpected result?

So I have a schema like this:

type NetZone {
  name: String
  version: String
  hasAccessTo: [HasAccess]
}

type HasAccess @relation(name: "HasAccess") {
from: NetZone
to: NetZone
version: String
}

So there is a "HasAccess" connect to "NetZone" itself, and that cause unexpected generated querties, like, totally unacceptable result, so I change to use custom query, and change type NetZone to something like this:

type NetZone {
  name: String
  version: String
  hasAccessTo(first: Int = 10, offset: Int = 0): [NetZone] @cypher(statement: "MATCH (this)-[r:HasAccess]->(target:NetZone) RETURN target SKIP $offset LIMIT $first")
}

So now it is working. But I really want to return something like this:

type _HasAccess {
  version: String
  netZone: NetZone
}

is there any way to achieve this, or a way to fix the first unexpected result?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM