Yuki Kunishige
Yuki Kunishige

Reputation: 13

How can I use order and find_each in neo4j.rb, Rails?

I use Neo4j.rb in Rails. I am trying this code.

 Person.all.order("n.score").find_each

or

Person.order(score: :asc).find_each

But,its does not get person order by.

Upvotes: 1

Views: 147

Answers (1)

Brian Underwood
Brian Underwood

Reputation: 10856

Currently the gem doesn't support that. You can see here that the order is fixed based on the property which is specified.

That link is from neo4j-core, by the way. You're using either this or this for ActiveNode. Those methods actually continue the hard-coding of the primary key as the ordering.

That said, this might not be necessary. When I was building the find_each / find_in_batches functionality I saw Cypher queries as potentially much more complicated than SQL queries because you don't just specify a column. I'm certainly open to other ideas

Upvotes: 1

Related Questions