Skip to content
Andreas Ronge edited this page Aug 25, 2014 · 8 revisions

Full documentation, see Neo4j::Session#query or RSpecs.

Examples using queries as strings:

# same as Neo4j::Session.current.query
Neo4j::Session.query.create(n: Label: {mydata: 'Hello'}).exec

# With cypher parameters
Neo4j::Session.query.start(n: "node({a_parameter})").params(a_parameter: 0).pluck("ID(n)").first

Example of chained queries:

query = Neo4j::Session.query.match(n: :person) # Returns a Query object
 

query.return(:n) # Also returns a Query object

query.return(:n).to_a # Returns an array of result rows as Structs (i.e. [<struct n=Node>, etc...])

query.pluck(:n) # Returns an array of nodes

query.return(n: [:name, :age]) # => [<struct name='Brian', age=33>, etc...]

query.where(name: /kalle.*/)

query.order(n: {name: :desc, age: :asc}).skip(5).limit(4) # sorting and skip and limit the result

query.match('n-[:friends]->o').where(o: {age: 42}, n: {age: 1})

query.match('n-[f:friends]->o').pluck(:f) # [<Relationship>, etc..]

WARNING: Much of the information in this wiki is out of day. We are in the process of moving things to readthedocs

Api

Contribute

Clone this wiki locally