ORMNeo
Abstract some trivial operations on neo4j driver for nodejs and make the use simpler. That's why we created ORMNeo.
Instalation
npm install ormneo
Usage
Connecting to neo4j database
const ormneo = require('ormneo');
ormneo.Connection.connect('neo4j', 'databasepass', 'localhost');
ORMNeo connects using the neo4j bolt protocol.
Create node example
const ORMNeoNode = require('ormneo').ORMNeoNode;
ORMNeoNode.create({ name: 'name', tes: 3 }, 'test').then((node) => {
}).catch((error) => {
});
Find Nodes
const ormneo = require('ormneo');
const ORMNeoNode = ormneo.ORMNeoNode;
const ORMNeoQuery = ormneo.ORMNeoQuery;
let query = ORMNeoQuery.query('test').and('tes', {$eq: 3});
ORMNeoNode.execute(query).then((nodes) => {
}).catch((error) => {
});
Create relations
const ORMNeoRelation = require('ormneo').ORMNeoRelation;
ORMNeoRelation.relate(node1.id, 'relatedto', node2.id, {property: 'a'}).then((rels) => {
}).catch((error) => {
});
Find Relations
conts ormneo = require('ormneo');
const ORMNeoRelation = ormneo.ORMNeoRelation;
const ORMNeoQuery = ormneo.ORMNeoQuery;
ORMNeoRelation.find(node1.id, node2.id, 'relatedto',ORMNeoQuery.query().and('property', {$eq: 'c'})).then((nodes) => {
}).catch((error) => {
});
Executing Cypher
You can executing cypher using the direct Neo4j Driver session object.
const ormneo = require('ormneo');
const ORMNeoCypher = ormneo.ORMNeoCypher;
ORMNeoCypher.execute(cypher).then((result) => {
console.log(result);
}).catch((error) => {
reject(error);
});
Documentation
See the full API documentation at docs. All docs was generated by JSDoc.
Tests
Most of this library functions are covered by unit tests. With 89% of coverage.
See the code coverage on codecov.io.
Licence
ORMNeo is released under the MIT License.