Some question with the example (https://tour.dgraph.io/schema/2/)


(Ogre) #1

Almighty Friends,How do I get its owner by pet name?
This is the data example https://tour.dgraph.io/schema/2/


(Pawan Rawal) #2

You add a reverse edge on owns_pet by doing the following schema alter operation.

owns_pet: uid @reverse

Then you search for the pet and traverse the reverse edge to the owner.

{
  pet(func: eq(name, "Goldie")) {
    name
    owner: ~owns_pet {
      name
    }
  }
}


(Ogre) #4

Thank you,

It turns out that dgraph has no attribute concept.

At the beginning of the design of the data model,I should locate the nodes and edges.

This can be searched according to various attributes


(system) #5

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