When filtering an edge, how do I exclude edges who’s subsequent node has a specific predicate defined? For example:
<replies>: [uid] .
<replyTo>: [uid] .
<comments>: [uid] .
<post>: uid .
type Comment {
post
replies
replyTo
}
type Post {
comments
}
I want to get a Post, and then all of its comments, and then all of the replies to each comment. This is what I have currently:
{
_allComments as var(func: type(Comment))
post(func: type(Post)) {
uid
comments @filter(not uid_in(replyTo, uid(_allComments))){
uid
replies {
uid
comments {
uid
}
}
}
}
}
But I’m worried about how it will perform at scale. What if I have 1M comments, does that mean that _allComments
will have to load in every single comment uid? Or does dgraph have some set-theory based optmization that means that this is the correct way to check for null?