Query Nodes Uniquely

This is a query that I make:

  myuser(func: uid(0x5a57, 0x5a57, 0x5a57)) {
      uid,
      some_other_fields
  }

this is the result:

  "data": {
    "myuser": [
      {
        "uid": "0x5a57"
      },
      {
        "uid": "0x5a57"
      },
      {
        "uid": "0x5a57"
      }
    ]

I am getting the uids from other var blocks. is there a way to somehow get unique results?
Not getting the same node 3 times.

UIDs will be unique if you get them from a var block, as can be seen below.

{
  s as var(func: uid(0x1,0x2,0x3,0x1))
  
  q(func: uid(s)){
    uid
  }
}

Result:

 "data": {
    "q": [
      {
        "uid": "0x1"
      },
      {
        "uid": "0x2"
      },
      {
        "uid": "0x3"
      }
    ]
  },
1 Like

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