All the data in your app form a GraphQL data graph. That graph has nodes of particular types and relationships between the nodes to form the data graph.
@hasInverse directive to tell Dgraph how to handle two-way
relationship.
@hasInverse, youβll need to migrate the data to add the reverse
edges.@hasInverse is used to create a two-way relationship.
posts and author are just two directions of the same link in the
graph. For example, adding a new post with
posts. Deleting the post removes it
from Aliceβs posts. Similarly, using an update mutation on an author to insert
a new post automatically adds Alice as the author.
Author had recently liked (so it can
suggest interesting material) and just a tally of all likes on a post.
@hasInverse is needed - so you
can enforce the semantics your app needs.