How to query node that "doesn't has" predicate?


(Andro West) #1

I want to add a deleted_at predicate on type schema to implement soft delete, I thought about it and didn’t know how to query nodes those weren’t been deleted.


(Andro West) #2

Solved, not that hard.

{
  userAlive(func: type(User)) @filter(not has(deleted_at)) {
    uid
    dgraph.type
    expand(_all_) {
      expand(_all_)
    }
  }
}