Order by nodes that received more relationships in a certain period of time

58 Views Asked by At

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? :)

1

There are 1 best solutions below

1
On BEST ANSWER

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