Child nodes returns wrong data


(Youmoo) #1

Hi. I haven this query:

{
  all(func:eq(userNo,"U53803987795374534400163E09A24A2")){
    userNo
    count(has)
    has{
      userNo
    }
  }
}

And when I run it and copy its response to chrome console, I saw this:

Is there any reason count(has) and has have different lengths?


(Michel Conrado (Support Engineer)) #2

hmmm

Add a filter. Maybe your “has” has a lot of orphans children’s. (or delete them, the relation)

{
  all(func:eq(userNo,"U53803987795374534400163E09A24A2")){
    userNo
    count(has) @filter(has(userNo))
    has{
      userNo
    }
  }
}

(Youmoo) #3

Thanks.
So, when I delete orphans , the relations should be deleted too? Or else the relations still remain.


(Michel Conrado (Support Engineer)) #4

yep.

Cuz the relation is from Parent to Child. If you delete the child the edge, in the parent, pointing to the child still remains.