# Graphql and neo4j depth problem (using GrandStack)

**URL:** <https://community.neo4j.com/t/graphql-and-neo4j-depth-problem-using-grandstack/34380>\
**Category:** GraphQL & GRANDstack\
**Created:** [February 26, 2021, 9:32am UTC](https://community.neo4j.com/t/graphql-and-neo4j-depth-problem-using-grandstack/34380 "2021-02-26T09:32:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gautierwojda1](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/gautierwojda1/32/16908_2.png) [@gautierwojda1](https://community.neo4j.com/u/gautierwojda1)\
**Post date:** [February 26, 2021, 9:32am UTC](https://community.neo4j.com/t/graphql-and-neo4j-depth-problem-using-grandstack/34380/1 "2021-02-26T09:32:16Z")

</div>

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

```auto
{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 :

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

```

Return only only the first child (depth 1 from entity) : [google.com](http://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 :

```auto
{
    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 :

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

```

to generate a query like

```auto
MATCH (n:Asset:Ipv4) 

```

instead of

```auto
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
