Dennis Gloss
Dennis Gloss

Reputation: 2841

Check if a field is undefined in DGraph query

I want to get only the nodes if one certain predicate is undefined.
Golang default values don't get stored as of now, and changing the current DGraph configuration would be pretty difficult.
I could filter them in the code afterwards, but I would appreciate a better solution.

Upvotes: 0

Views: 47

Answers (1)

Dennis Gloss
Dennis Gloss

Reputation: 2841

Forgot to answer it last time, forgot the solution and stumbled upon the same issue🤦

As for now, there's no way to check for null/undefined directly. Use ge, gt, le, lt functions.
E.g. If the field's type is a number then use not gt(field_name, 0). If it's a date not gt(field_name, "1970-01-01T00:00:00Z") and so on. If you use the default values, be creative.

Upvotes: 0

Related Questions