Uid_not_in query filter to exclude some ids

The syntax is

func: eq(...)) @filter(NOT uid_in(pred, 0x1) AND uid_in(pred, $restUIDS))

See more at https://dgraph.io/docs/query-language/connecting-filters/#and-or-and-not

If you just wanna take off you from the query(not as a root param) you would do like

func: eq(...)) @filter(uid_in(pred, $restUIDS)) {
   pred @filter(NOT uid(me)) { 
    uid 
    name 
    ... 
  } 
}

more here https://dgraph.io/docs/query-language/functions/#uid

One more thing

To the last example you can also use ignorereflex directive https://dgraph.io/docs/query-language/ignorereflex-directive/

1 Like