Lets assume I added Posts and Authors from an external resource into DGraph, yet did not establish their relationship during the eg. bulk insert.
So I assume I have to Update Authors to set a relationship to Posts. How can I update an author and establish a relationship to a post, when I know the authors id and
the ids of the posts the relationship should be established with? Can I establish multiple relationships in one single update mutation, eg. if I know that author 0x1234 shall be assigned posts identified by ids 0x20 and 0x40
a search criteria for a post title (which matches more but one post) which shall be assigned to author 0x1234?
How will I be able to remove a relationship?
say I would like to remove the relationship from author identified by id to post identified with id
say I would like to remove the relationship from author identified by name to posts matching title
An update mutation can use any searchable fields, not only the ID. So you could do an updatePost mutation with the filter matching your titles and then setting an author edge. But… Right now in the schema example above, there is no Post.author edge with a linking @hasInverse directive. I would set that up before creating any edges.
Thank you, I was not aware of that, indeed it works perfectly! I added where sensible @hasInverse. BTW. the expected parameter for an update mutation is input not patch. Patch is the mostly used variable name when using variable style.