Basic Cypher operations

A small collection of basic cypher commands so I don’t have to Google them everytime.

Count how many nodes of a type there are

MATCH (n:StagingSalesforceAccount)
RETURN count(n)

Create a named index

CREATE INDEX index_name IF NOT EXISTS FOR (n:Label) ON (n.property)

See the properties on a type of node

MATCH (n:Label {id: 123})
RETURN properties(n) AS allProps;

Delete all of a specific type of node

// Delete nodes
// Will result in an error if the nodes have relationsips
MATCH (n:Label) DELETE n

// Delete nodes even if they have a relationship
MATCH (n:Label) DETACH DELETE n

Send a Comment

Your email address will not be published.