If a Person has multiple dgraph.types , how to get the first one?

This

{
    users(func: type(Person), first: 10) {
    uid
    dgraph.type
  }
}

returns:

{
        "uid": "0x11",
        "dgraph.type": [
          "user",
          "user.telegram",
          "Person"
        ]
}

how to get this (ie: only the first type)?

{
        "uid": "0x11",
        "dgraph.type": "user"
}

As far as I know you don’t (Lists are not sorted or have some offset, mapping or something). dgraph.type is preferably for internal use of Type System. This would be an improvement in List Type tho.

1 Like

Thanks!

Does dgraph.type have performance superiority over ordinary index?

func: type(Person)

vs

func: eq(MyType, "Person")

which one is faster?

func: type(Person)

1 Like