Child nodes returns wrong data

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?

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
    }
  }
}

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

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.

1 Like