Expand(_reverse_) not going through incoming edges

Hey

Alice(0x1) and Bob(0x2) are friend, such as Alice -> friend -> Bob.

So when I run the following:

{
  get(func: uid(0x1)) {
    uid
    expand(_forward_) {
      uid
    }
  }
}

I get as expected:

{
    "data": {
      "get": [
        {
          "uid": "0x1",
          "friend": [
            {
              "uid": "0x2"
            }
          ]
        }
      ]
  }
}

But then, if I run the same command from Bob(0x2) in a reverse way:

{
  get(func: uid(0x2)) {
    uid
    expand(_reverse_) {
      uid
    }
  }
}

I expect something like:

{
    "data": {
      "get": [
        {
          "uid": "0x2",
          "friend": [
            {
              "uid": "0x1"
            }
          ]
        }
      ]
  }
}

But I actually get:

{
    "data": {
      "get": [
        {
          "uid": "0x1"
        }
      ]
  }
}

Apparently the expand(_reverse_) does not go through incoming edges?

It is working as expected, you probably not setting the “friend” pred as reverse.
Go to “schema” painel, go to friend properties and set as “reverse”.

1 Like

Indeed, it worked, thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.