Expand(_reverse_) not going through incoming edges


#1

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?


(Michel Conrado) #2

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”.


#3

Indeed, it worked, thanks!


(system) closed #4

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