npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

neo-maggoo

v0.6.5

Published

Futuristic Models & Collections for Neo4j

Downloads

12

Readme

Neo Maggoo

Build Status Coverage Status

Neo4j OGM for Node.js using proxified ES6 classes

WARNING: This package is still in an experimental state, currently in active development and could change at any time.

Installation

npm install neo-maggoo --save

Requirements

  • Node.js >= 6.0.0
  • Neo4j >= 3.0.0

Docs

https://bram-l.github.io/neo-maggoo/

Examples

const { Node, Relationship, DB } = require('neo-maggoo')

// Node definition
class Person extends Node {
    static get relationships()
    {
        return {
            relatives: {
                Model: Person,
                type: 'is_related_to',
                direction: Relationship.OUT
            },
            father: {
                Model: Person,
                type: 'is_father_of',
                direction: Relationship.IN,
                singular: true // Returns a single node instead of an array
            },
            mother: {
                Model: Person,
                type: 'is_mother_of',
                direction: Relationship.IN,
                singular: true // Returns a single node instead of an array
            }
        }
    }
}

// Initialize database connection
DB.init(NEO4J_BOLT_URL, NEO4J_USER, NEO4J_PASSWORD)

READ

Get all nodes

const people = await Person.all()
assert(people.length)

Get a single node

// Find by UUID
const person = await Person.get('foo')
assert(person.id === 'foo')
// Find by Neo4j ID (NOTE: this may change over time)
const person = await Person.get(1)
assert(person.$id === 1)

Find nodes using filter

const people = await Person.find({ name: 'foo' })
assert(people[0].name === 'foo')
const people = await Person.find({ name: 'foo' }, { with: 'relatives' })
assert(people[0].name === 'foo')
assert(people[0].relatives.length)

Find with related nodes

const foo = await Person.get('foo', { with: 'relatives' })
assert(foo.relatives.length)
const foo = await Person.get('foo', { with: 'father.father' })
assert(foo.father.id)
assert(foo.father.father.id)
const foo = await Person.get('foo', { with: ['father.father', 'mother'] })
assert(foo.father.id)
assert(foo.father.father.id)
assert(foo.mother.id)
const foo = await Person.get('foo', { with: { relatives: { name: 'bar' }, 'relatives.father': true } })
assert(foo.relatives[0].name === 'bar')
assert(foo.relatives[0].father.id)

Find nodes using query

const people = await Person.query('MATCH (n) WHERE n.id = {id}', { id: foo }, { with: 'relatives' })
assert(people[0].id === 'foo')
assert(people[0].relatives.length)

Count nodes

const total = await Person.count()
assert(total > 0)
const total = await Person.count({ name: foo })
assert(total > 0)
const total = await Person.count('WHERE n.name = {name}', { name: foo })
assert(total > 0)

WRITE

Save an entire graph

const foo = await Person.get('foo', { with: 'father' })
foo.father.name = 'baz'
await foo.save(true) // Will save foo.father

Save nested nodes

const foo = new Person()
const bar = new Person()
foo.relatives.push(bar)
await foo.save(true) // Saves foo & bar, and creates a 'is_related_to' relationship

Delete collection

const people = await Person.all()
await people.delete()

Delete an entire graph

const foo = await Person.get('foo', { with: 'relatives' })
await foo.delete(true) // Deletes foo and its related nodes