Skip to content

Instantly share code, notes, and snippets.

@miharekar
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save miharekar/2842e3f3ce2f74a3486a to your computer and use it in GitHub Desktop.

Select an option

Save miharekar/2842e3f3ce2f74a3486a to your computer and use it in GitHub Desktop.
Most followed user
# Is there a better way to do this? I have User model
Neo4j::Session.query
.match('()-[n:FOLLOWS]->(u)')
.with('u, COUNT(n) AS c')
.return('u, c')
.order('c DESC')
.where('c > 2').to_a
# Additionaly I want to remove some users %w(mrfoto mfilej otobrglez) for example
# I came up with this but I'm wondering if there's a better way?
.where("NOT (u.login in #{users})")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment