Reputation: 71
I added vertices with createDate
as a property. I want to retrieve the latest created vertex using createDate
property.
How can I retrieve this. Please help me with this.
Upvotes: 1
Views: 6517
Reputation: 46226
Just order()
your vertices in descending order by the createDate
and grab the first one:
gremlin> g = TinkerGraph.open().traversal()
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
gremlin> g.V().order().by('createDate', desc).limit(1)
==>v[2]
gremlin> g.V().order().by('createDate', desc).limit(1).values('createDate')
==>22-OCT-2019
Upvotes: 7