Hari Ram
Hari Ram

Reputation: 305

How to insert date datatype in cayley db?

I need to insert date value in a node. Something like creation date for another node. But in cayley, we could only insert string datatype. I may use the toString() and save the date as string. But, while retrieving, I need to filter by giving a date range. How would I possibly do this?

BTW, I'm using gremlin programming language to retrieve.

Upvotes: 0

Views: 170

Answers (2)

Denys Smirnov
Denys Smirnov

Reputation: 48

Cayley recognizes schema.org data types, thus you can use DateTime type for your values:

"1990-07-04T17:25:41Z"^^<http://schema.org/DateTime>

Later you can use Gizmo to query date ranges:

var d = new Date(1900, 1, 1);
g.V().Has("<birthDate>", gt(d)).All()

Upvotes: 1

Muhammad Ali
Muhammad Ali

Reputation: 732

Perhaps you can store the dates as unix time-stamps? That way, even if you do a string comparison you'll get the correct results.

Upvotes: 0

Related Questions