Composite index in Dgraph?

56 Views Asked by At
type Species {
    name: String! @id
    animals: [Animal!]! @hasInverse(field: species)
}

type Animal {
    name: String!
    species: Species!
}

How do I make animal name unique within species? So that I can allow only one dog named Bob, but also one cat with the same name.

1

There are 1 best solutions below

0
beardeadclown On

Apparently there is already a similar thread on the Dgraph forum: https://discuss.dgraph.io/t/composite-id-fields/13337