Closed smeijer closed 4 years ago
Unique is only used for 1:1. Why would you add blog() unique ? If you don't specify many: true
blog will return a single element. Unique != Single.
Why would you add blog() unique?
Because a comment only has a single blog that it belongs to? The link directive doesn't seem to have the many
argument that you're referring to. What am I missing?
unique
makes the result flip between many and one. (array / object). I'm still unable to get both the Blog.comments
as well as the Blog.comment
resolvers to work. I need comments
to return all the comments (array) and comment
to return a single object.
How should I approach that?
@theodorDiaconu , I'm still not able to get this working. Is it because I'm using the directives?
I'm trying to get a
1:1
and a1:∞
relation to a single type.Let's say I have a
Blog
, and a singleBlog
, has manyComments
.Blog
has 2 resolvers.comment
, returns a singleComment
byid
comments
, returns allComment
sI understand that to get the
1:1
working, I need to add theunique
onComment.blog
. The issue is, that this affects both theBlog.comment
as well asBlog.comments
resolvers.Thereby, I think that
unique
is currently being defined on the "wrong side" of the relationship, and we should be defining atype: 'one'
on theBlog.comment
definition, instead of onComment.blog
.