Socket
Socket
Sign inDemoInstall

ormneo

Package Overview
Dependencies
7
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ormneo

ORM abstraction layer for neo4j


Version published
Weekly downloads
2
decreased by-85.71%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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) => {
       //Created returned object => {id: 1, name: 'name', tes: 3}
  }).catch((error) => {
       //Handle error
  });

Find Nodes

  const ormneo = require('ormneo');
  const ORMNeoNode = ormneo.ORMNeoNode;
  const ORMNeoQuery = ormneo.ORMNeoQuery;
  const ORMNeoWhere = ormneo.ORMNeoWhere;
  
  let where = new ORMNeoWhere('tes', {$eq: 3});
  let query = ORMNeoQuery.query('test', where);
  
  ORMNeoNode.execute(query).then((nodes) => {
      //Found nodes.
  }).catch((error) => {
      //Handle error.
  });

Create relations

  const ORMNeoRelation = require('ormneo').ORMNeoRelation;
  ORMNeoRelation.relate(node1.id, 'relatedto', node2.id, {property: 'a'}).then((rels) => {
        // Created relation node {id: 2, type: 'relatedto', property: 'a'}
  }).catch((error) => {
        //Handle error
  });

Find Relations

  conts ormneo = require('ormneo');
  const ORMNeoRelation = ormneo.ORMNeoRelation;
  const ORMNeoWhere = ormneo.ORMNeoWhere;

  ORMNeoRelation.find(node1.id, node2.id, 'relatedto', new ORMNeoWhere('property', {$eq: 'c'})).then((nodes) => {
        //Found relation nodes.
  }).catch((error) => {
        //Handle error.
  });

Executing Cypher

You can executing cypher using the direct Neo4j Driver session object. Or you can use ORMNeoCypher.

  const ormneo = require('ormneo');
  const ORMNeoCypher = ormneo.ORMNeoCypher;

  ORMNeoCypher.execute(cypher).then((result) => {
     console.log(result);
  }).catch((error) => {
     reject(error);
  });

Creating and droping indexes

You can create and drop indexes in properties.

  const ormneo = require('ormneo');
  const ORMNeoIndex = ormneo.ORMNeoIndex;
  //Creating
  ORMNeoIndex.create('label', ['property']).then((result) => {
     //Handle creation
  });
  //Droping
  ORMNeoIndex.drop('label', ['property']).then((result) => {
     //Handle drop
  });

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.

Keywords

FAQs

Last updated on 21 May 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc