1

Is it possible to order by nodes that received more relationships in a certain period of time?

For example, I have User and Movie, and a User can LIKE a Movie. The LIKE relationship has a property called date, which is the moment the user liked the product.

What I want is: the Products that received more LIKE in the last 2 days.

How can I do it? :)

sadtroll
  • 191
  • 4
  • 17

1 Answers1

0

I'm assuming that you are storing dates as strings like "2017-09-02 00:00:00". So in this case I believe you can try something like:

MATCH (:User)-[like:LIKE]->(movie:Movie)
WHERE like.date > "date from 2 days ago"
RETURN movie, count(like) as numberOfLikes
ORDER BY numberOfLikes DESC
Bruno Peres
  • 15,845
  • 5
  • 53
  • 89
  • I only changed the the MATCH part to `MATCH(movie:Movie)<-[like:LIKED]-()` e funcionou. Obrigado! :D – sadtroll Oct 10 '17 at 02:51