node-neo4j-embedded
The embedded Neo4j Graph Database for Node.js.
Installation
npm install neo4j-embedded
Documentation
API documentation can be found here: http://docs.whitefrog.de/neo4j-embedded
Usage
Note that the Neo4j version is 1.9, so you need Java 7 on your machine for this to work. If you want to change that, you need to edit the pom.xml and compile for yourself.
Create a database
var neo4j = 'neo4j-embedded';neo4j;neo4j;// default embeddedneo4j;// enable REST and Webinterfaceneo4j;// connect to a high availability clusterneo4j;// connect to a high availability cluster, enabling REST and Webinterfaceneo4j;
Create nodes and relationships
var tx;trytx = database;var homer = database;var marge = database;var married = homer;tx;catchetx;finallytx;
Delete nodes and relationships
var tx;trytx = database;var homer = database;var married = homer;married;homer;tx;catchetx;finallytx;
Deal with properties
var tx;trytx = database;var marge = database;marge;marge;var properties = marge;// properties: {name: 'Marge Simpson', haircolor: 'blue'}var hairColor = marge;// hairColor: 'blue'tx;catchetx;finallytx;
Handle indices
var tx;trytx = database;var marge = database;margeindex'SIMPSONS' 'name' marge;marge;tx;catchetx;finallytx;
Cypher queries
var query = 'START n=node({search}) RETURN n';database;
Query Builder
var query = database;query;// disable counting// query.dontCount(); -> total will be -1query;
Testing
cd node-neo4j-embeddednpm install --devnpm test