cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Graphql and neo4j depth problem (using GrandStack)

Hi,
I'm trying to use Graphql with neo4j for my enterprise.
For a short presentation, lets imagine this graph :

{User1:User} -> {Entity1:Entity} -> {google.com:Asset:Domain} -> {dns.google.com:Asset:Subdomain} -> {8.8.8.8:Asset:Ipv4} -> {80:Asset:port} .....Etc

What we have done : We use a webtoken to get auth, and get current UserId to get the User's graph and all his associated entity. (Using @\IsAuthentificated / @\HasRole directive)
.
We can make request from auth user to get his entity, but when we try to access all subnodes from this entity, it only return the first child.
.
(In our exemple, the following request :

{
    me {
      entity {
        asset {
          _id
          value
          type
        }
      }
    }
  }

Return only only the first child (depth 1 from entity) : google.com (the domain)

We tried to use @cypher directive, and using it we can get all Asset BUT we can not use filter !

TL;DR : We want to be able to make 2 things :

  • Be able to get all children with unlimited depth

.
For exemple :

{
    me {
      entity {
        asset {
          _id
          value
          type
        }
      }
    }
  }

.
should return all our Asset (Domain, Subdomain, Ipv4, Port..)
And be able to filter on Asset by value, date etc..
.

  • be able to get all asset with particular label from asset (to reduce db access cost. As i said, we have a very big data base.)

.
For exemple :

{
    me {
      entity {
        asset (filter: {type: "Ipv4"}) {
          _id
          value
          type
        }
      }
    }
  }

to generate a query like

MATCH (n:Asset:Ipv4) 

instead of

MATCH (n:asset) WHERE n.type = "Ipv4"

Their is a way to do this using grandstack pre-gen queries or we have to wrote our own resolvers ?
Thank's

0 REPLIES 0