# ormneo

> ORM abstraction layer for neo4j

Latest version **0.2.0** (published 2017-05-21) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install ormneo
pnpm add ormneo
yarn add ormneo
bun add ormneo
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2017-05-21 |
| First published | 2017-04-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 53 |
| Author | Luciano Almeida |
| Maintainers | lucianoalmeida |
| Keywords | neo4j, ORM, cypher, javascript, es6, nodejs, bolt, database, database-abstraction |

## Links

- npm: https://www.npmjs.com/package/ormneo
- Repository: https://github.com/LucianoPAlmeida/ORMNeo
- Issues: https://github.com/LucianoPAlmeida/ORMNeo/issues
- npm.io page: https://npm.io/package/ormneo

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [neo4j-driver](https://npm.io/package/neo4j-driver.md) ^1.2.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2017-05-21
- 0.1.15 — 2017-05-17
- 0.1.14 — 2017-05-17
- 0.1.13 — 2017-05-14
- 0.1.12 — 2017-05-10
- 0.1.11 — 2017-05-10
- 0.1.10 — 2017-05-09
- 0.1.9 — 2017-05-07
- 0.1.7 — 2017-05-07
- 0.1.6 — 2017-05-07
- 0.1.5 — 2017-05-03
- 0.1.4 — 2017-05-03
- 0.1.3 — 2017-05-03
- 0.1.2 — 2017-05-03
- 0.1.1 — 2017-04-30
- … 1 more at https://npm.io/package/ormneo/versions

## README

# ORMNeo

Abstract some trivial operations on neo4j driver for nodejs and make the use simpler. That's why we created ORMNeo.

## Instalation
```sh
 npm install ormneo
```
## Usage 

### Connecting to neo4j database

```js
const ormneo = require('ormneo');
ormneo.Connection.connect('neo4j', 'databasepass', 'localhost');

```
   ORMNeo connects using the neo4j bolt protocol.

### Create node example

```js
  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 
  ```js
    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
```js
  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 

```js
  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](https://github.com/neo4j/neo4j-javascript-driver) session object. Or you can use ORMNeoCypher.

```js
  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.

```js
  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](docs). All docs was generated by [JSDoc](https://github.com/jsdoc3/jsdoc).

## Tests

  Most of this library functions are covered by unit tests. With 89% of coverage.
  See the code coverage on [codecov.io](https://codecov.io/gh/LucianoPAlmeida/ORMNeo).

## Licence

ORMNeo is released under the [MIT License](https://opensource.org/licenses/MIT).

---
_Source: https://npm.io/package/ormneo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
