Akshay Gaikwad
Akshay Gaikwad

Reputation: 460

Edge timestamp in gremlin

Can I get time-stamp of edge & vertex created in gremlin

a.addEdge("has",b)

a & b are two vertices. How do I get the time of edge creation?

Upvotes: 0

Views: 702

Answers (1)

Daniel Kuppitz
Daniel Kuppitz

Reputation: 10904

Edges (or rather elements in general) do not have any metadata if that's what you're asking for. You'll have to store the timestamp of creation as a property when you create the edge. Later you can query the timestamp just like any other property.

// create the edge
a.addEdge("has", b, "created", System.currentTimeMillis())

// get the timestamp
g.V(a).outE("has").filter(inV().is(b)).values("created")

Upvotes: 2

Related Questions