Skip to content
Max De Marzi edited this page Mar 21, 2014 · 4 revisions

Creation

Neography::Node.create                                               # Create an empty node
Neography::Node.create("age" => 31, "name" => "Max")                 # Create a node with some properties
@neo2 = Neography::Rest.new({:server => '192.168.10.1'})
Neography::Node.create({"age" => 31, "name" => "Max"}, @neo2)        # Create a node on the server defined in @neo2

Indexing

new_node = Neography::Node.create("name" => "sun")                   # Create a node with "name" property
new_node.add_to_index("node_test_index", "name", "sun")              # Index node on property "name"

Loading

@neo = Neography::Rest.new
Neography::Node.load(5, @neo)                                        # Get a node and its properties by id
Neography::Node.load(existing_node, @neo)                            # Get a node and its properties by Node
Neography::Node.load("http://localhost:7474/db/data/node/2", @neo)   # Get a node and its properties by String

If you don't pass the rest client, it will create a new one, so make sure pass it in if you are loading lots of nodes.

Neography::Node.load(5, @neo2)                                       # Get a node on the server defined in @neo2

Finding

Neography::Node.find(index, key, value)                              # advanced query of the node index with the given key/value pair
Neography::Node.find(index, query)                                   # advanced query of the node index with the given query

Deletion and existence

n1 = Node.create
n1.del                                                               # Deletes the node
n1.exist?                                                            # returns true/false if node exists in Neo4j
Clone this wiki locally