Reputation: 61
I want to create relationships with label type date. Something like this
create (n:Person{name:"Chris"})-[:date("2012-12-02")]->(m:Christos{name:"Nick"}) return n,m
I don't want the date as a property to avoid getting in the disc space and I want to avoid setting the date as a string because it is very slow to compare the string (or transform it to a date).
What is the "fastest" way to set the dates and use them? The relationship is "knows since" the date I plug in.
Is it possible to somehow have dates as relationship types?
Upvotes: 0
Views: 135
Reputation: 9284
Type
of a relationship
and Labels
of a node
is only of type String. We cannot values of any other datatype. If you want the lookups to be faster, you can store the date value as a property in the relationship and create an index on that property. Like this:
create (n:Person{name:"Chris"})-[:KNOWS_SINCE{since:date("2012-12-02")}]->(m:Christos{name:"Nick"}) return n,m
CREATE INDEX rel_1 FOR ()-[r:KNOWS_SINCE]-() ON (r.since)
Upvotes: 1