Jessica
Jessica

Reputation: 235

Nodes in Neo4j with same property value

I have a database that stores multiple nodes representing sensors. Each node sensor will relate to a node date. So I have multiple date nodes that will have the same property value, in other words, the same date. But at the time of consulting in Cypher of an existing date like MATCH (n:Data) WHERE n.data = '1998-01-01' RETURN n shows that there are no rows. Can someby help me? The only property field of date nodes is "data".

Upvotes: 0

Views: 663

Answers (1)

David Perez
David Perez

Reputation: 488

I wanted to comment but i cant yet. You should consider changing your db and have nodes representing the dates, and then the sensors nodes would have a relationship with the date nodes. This way you wont have repeated data.

This would be the schema:

(s:sensor)-[:measured_in]->(d:Date {date:"1998-01-01"})

And this would be the query:

MATCH (d:date)<-[:measured_in]-(s:sensor) WHERE d.date="1998-01-01" return s

Upvotes: 1

Related Questions