Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4j DATE Data Types

Tags:

date

neo4j

I am using Neo4j 2.0 version. Suppose, I have lot of records which have date as one of their fields and if we need to support lot of queries like count of records between two specific dates etc, I think that I may have tpo index all the records by Date field. Is this correct? Then., how do I do it. All nodes of the type "RECORD" need to be indexed dy date. How can I achieve this? Please note that Date is a not unique field. And how do I even store Date property in the records. Is Date supported in CYPHER or Neo4j. How do I sort the records by Date field?

like image 764
Vineel Avatar asked Feb 08 '14 08:02

Vineel


People also ask

What data types does Neo4j support?

Integer, Float, String, Boolean, Point, Date, Time, LocalTime, DateTime, LocalDateTime, and Duration.

Is Neo4j still relevant?

The World's Leading Organizations Rely on Neo4j. With more than 950 enterprise customers, Neo4j is the world's leading provider of scalable graph technology, enabling connected data applications for more than 75% of the Fortune 100.

What are the weaknesses of Neo4j?

Additionally, Neo4j has scalability weaknesses related to scaling writes, hence if your application is expected to have very large write throughputs, then Neo4j is not for you.

Does Neo4j have schema?

Schema. A schema in Neo4j refers to indexes and constraints. Neo4j is often described as schema optional, meaning that it is not necessary to create indexes and constraints. You can create data — nodes, relationships and properties — without defining a schema up front.


1 Answers

Dates as values for properties are not directly supported. Depending on your usecase you typically store the millis since epoch (aka date.getTime()) in a long property or a string representation using a DateFormatter (when being in Java land).

The long representation is better suited if you intend to do any math operation with dates. String is better if you want your properties being human readable without any conversion.

When requiring indexes on dates the easiest approach would be storing millis since epoch and apply a schema index on this.

like image 195
Stefan Armbruster Avatar answered Sep 18 '22 15:09

Stefan Armbruster