Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-20-2019 09:36 PM
Hi, I'm new in Neo4j, and I'm working and searching to learn more about it and graph usage.
I made this querry but it says that I have an error, anyone can help me so I can move on? What I want to know is what some user has bought between 2 dates (I used "EventDate" because its an existing property, with "date" it has the same result - error):
<
MATCH (ee:User) - [:Buy] - (Product)
WHERE ee.UserId = "u20784378"
WITH eventDate("2018-04-08") AS startDate, eventDate("2018-07-08") AS endDate
RETURN Product
Thanks 🙂
06-20-2019 11:36 PM
Try this:
Assuming eventDate is a property of Product
MATCH (ee:User) - [:Buy] - (p:Product)
WHERE ee.UserId = "u20784378"
AND p.eventDate >= "2018-04-08" AND p.eventDate <= "2018-07-08"
RETURN p;
06-20-2019 11:46 PM
Also note that Neo4j has native temporal types: https://www.adamcowley.co.uk/neo4j/temporal-native-dates/
06-21-2019 01:49 AM
Note also you can chain the inequalities:
MATCH (ee:User) - [:Buy] - (p:Product)
WHERE ee.UserId = "u20784378"
AND "2018-04-08" <= p.eventDate <= "2018-07-08"
RETURN p;
06-21-2019 03:12 AM
Thanks all, and thanks for the link
06-23-2019 11:32 PM
Tried, but eventDate is a property of a relationship between User and Product, in this case is "Buy". So it doesn't work 😞
06-24-2019 12:43 AM
Try this:
MATCH (ee:User) - [r:Buy] - (p:Product)
WHERE ee.UserId = "u20784378"
AND "2018-04-08" <= r.eventDate <= "2018-07-08"
RETURN p;
06-24-2019 12:49 AM
Thank you for your help
All the sessions of the conference are now available online