Hi Team,
I used @hasInverse properly, i.e. it works with GraphQL:
type User {
saved: [Post!] @hasInverse(field: savedBy)
}
interface Post {
id: ID!
savedBy: [User!] @hasInverse(field: saved)
}
type Illustration implements Post {
}
However, the Ratel UI doesn’t say so:
anargu
(Anthony Arostegui)
September 26, 2020, 4:10pm
2
I have the same problem. There are any news about this issue?
MichelDiz
(Michel Diz)
September 26, 2020, 4:27pm
3
The implementation of hasInverse doesn’t use the native reverse index. That’s something that @pawan would explain better.
amaster507
(Anthony Master)
September 26, 2020, 5:21pm
4
He explained it already over here
Users of GraphQL± would know that we have @reverse index that allows you to automatically create reverse edges .
In GraphQL, we have @hasInverse.
type Author {
...
posts: [Post] @hasInverse(field: author)
}
type Post {
...
author: Author
}
So adding a post for an author also adds the author for the post and vice versa.
Under the hood, this is not implemented using @reverse index. There are two separate predicates created here, i.e.
Author.posts: [uid]
Post.author: uid.
Thi…
Let us know where you stand after reading that.
1 Like