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?
I want to query dgraph for a post and all its related comments formatted in a tree structure. Right now I can get a post all of its edges to its comments. I want to filter all the edges between a post and a comment to exclude all comment’s who’s replyTo edge is null. Then I will use the comments “replies” edge to follow each comment thread.
@vinum I’m awayre of the has function but it doesn’t do the same thing is the GQL has filter. The has function includes all nodes who’s type includes a predicate, but it doesn’t check for null values. I need to filter if an edge is null.
When using you are using cascade then it automatically filters the results that are null. If a comment does not have replyTo it should not appear in results.
See that’s why I posted this thread, the has function isn’t checking if replyTo is null. I want only nodes of type Comment who’s replyTo predicate is null.
So eq(count(replyTo), 0) was what I was looking for. Though I feel like we should have a null checking function, or an inverse cascade (not sure how it would work)? Oh well, problem solved.