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 🙏

© 2024 – Pkg Stats / Ryan Hefner

loopback-connector-neo4j-graph

v1.1.1

Published

Neo4j graph database connector for the LoopBack framework.

Downloads

10

Readme

loopback-connector-neo4j-graph

Introduction

Cypher based Neo4j connector for loopback-datasource-juggler using the node-neo4j Neo4j REST API client library. This loopback connector was developed by referring to the codebase of loopback-connector-mongodb. Thanks to all the nodejs open source community, developers and contributors of the above libraries and others that made this possible. Thanks to the contributors and users of this library as well.

Install

Change to your project directory and execute:

npm install --save loopback-connector-neo4j-graph

Test

After install, change to the module directory and run npm test. Make sure Neo4j service is running on localhost.

cd node_modules/loopback-connector-neo4j-graph
npm test

Sample Configuration

Add neo4j in server/datasources.json

"neo4j": {
        "port": 7474,
        "username": "neo4j",
        "password": "neo4j",
        "name": "neo4j",
        "connector": "neo4j-graph",
        "hostname": "127.0.0.1"
    }

Usage

Model objects would work just like in MongoDB. However, relations will not be mapped to graph vertices as of now. Use cypher for creating vertices and for graph queries.

Executing cypher

Replace "ModelClass" in the following examples with the name of the model class being used.

Simple queries

ModelClass.dataSource.connector.execute(
    "MATCH (n) RETURN n LIMIT 100",
    function (err, results) {
        if (err) {
            throw err;
        } else {
            // do something with results
        }
    }
);

Queries with parameters

var cypher = {
    query: "MATCH (u:User {email: {email}}) RETURN u",
    params: {
        email: '[email protected]',
    }
};
var options = {};
var callback = function (err, results) {
    if (err) {
        throw err;
    }
    var result = results[0];
    if (!result) {
        console.log('No user found.');
    } else {
        var user = result['u'];
        console.log(JSON.stringify(user, null, 4));
    }
};

ModelClass.dataSource.connector.execute(
    cypher,
    [],
    options,
    callback
);

Note: For transactional queries, the transaction may be passed in options.tx