Skip to content

Latest commit

 

History

History
73 lines (52 loc) · 1.73 KB

README.md

File metadata and controls

73 lines (52 loc) · 1.73 KB

Meteor Icon

Meteor Neo4j [MAINTAINER WANTED]

This package allows you to connect and query Neo4j from Meteor.

Check out this article.

Installation (Mac)

# install neo4j
brew install neo4j
# add ccorcos:neo4j to your project
meteor add ccorcos:neo4j
# start neo4j
neo4j start
# start meteor
meteor
# stop neo4j
neo4j stop

You can access the Neo4j admin browser interface here.

Commandline Utilities

m4j can start and stop Neo4j localized to your .meteor project.

curl -O https://raw.githubusercontent.com/ccorcos/meteor-neo4j/master/m4j
chmod +x m4j
# start within a meteor project
m4j start
# stop neo4j
m4j stop

m4j will edit the configuration files for Neo4j to do this so you need to provide a NEO4J_PATH environment variable. Put this in your ~/.bashrc:

export NEO4J_PATH=/usr/local/Cellar/neo4j/2.1.7

Also, meteor reset will clear Neo4j as well, but you may want to make sure to stop Neo4j before doing that.

API

You can create a Neo4j connection (url defaults to localhost:7474)

Neo4j = new Neo4jDb(optionalUrl)

Neo4j will be autoconnected if given Meteor.settings.neo4j_url or process.env.NEO4J_URL.

You can query Neo4j using Cypher.

result = Neo4j.query "MATCH (a) RETURN a"

When stringifying variables into Cypher queries, use Neo4j.stringify and Neo4j.regexify.

str = Neo4jDB.stringify
Neo4j.query "CREATE (p:PERSON #{str(user)}) RETURN p"

regex = Neo4jDB.regexify
Neo4j.query "CREATE (p:PERSON) WHERE p.name =~ #{regex(query)} RETURN p"