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


(Darren Hoo) #1

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

(Michel Conrado) #2

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.


(Darren Hoo) #3

Thanks!

Does dgraph.type have performance superiority over ordinary index?

func: type(Person)

vs

func: eq(MyType, "Person")

which one is faster?


(Michel Conrado) #4

func: type(Person)