Search code examples
graphgremlingremlin-servertinkerpop

How to check the given property is not present or it's greater/less than some value in Gremlin?


How to check the given property is not present or it's greater/less than some value in Gremlin?

g.V(1).hasNot('end_date_time').hasNext()

g.V(1).has('end_date_time', gte(current_timestamp)).hasNext()

Want to combine the above queries to one.


Solution

  • You can simply or the two conditions together

    g.V(1).or(hasNot('end_date_time'),
              has('end_date_time', gte(current_timestamp))