I am new Gremlin and having trouble with filtering by property.
A -> B
Assume A
and B
are vertices and has edge between them with properties Created_on
and deleted_on
.
deleted_on
property will be added only at the time of deletion.
How list by the edge property?
g.V(id).outE('Label').has('deleted_on', lt(timestamp.now())).outV().elementMap()
The above query returns empty, because the deleted_on
property is not added to the edge yet.
How to handle this?
I'm not completely sure but I think you are looking to find all connections where the deleted_on
property is less than now
or it does not exist. If that is the case then you can use the or() and hasNot() steps in Gremlin to accomplish this similar to the query below.
g.V(id).
outE('Label').
has('deleted_on', lt(timestamp.now())).
or().
hasNot('deleted_on').
outV().
elementMap()