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

fluent-neo4j

v0.4.7

Published

Speak fluently to your Neo4j graph database

Readme

Fluent Neo4j

This package allows you to run any cypher query you like agains your Neo4j instance in a promise-style.

The results will be formatted for your convenience.

To build the query check out the API docs of fluent-cypher

Table of Contents

Usage

You'll need to set env params to connect to neo4j

export NEO4J_URL="bolt://localhost:7687"
export NEO4J_USER="neo4j"
export NEO4J_PASS="neo4j"

Now you can use the package on the server.

const Neo4jQuery = require('fluent-neo4j')
//or
import Neo4jQuery from 'fluent-neo4j'

constuctor([options])

var query = new Neo4jQuery()

See constructor options of fluent-cypher

Methods

All methods return a promise. So after any fetch method building the query is not possible anymore.

.fetch([extractAlias])

Returns the first row of results as an object and if specified accesses the alias of the row.

new Neo4jQuery()
	.match({$: 'myNode', name: 'Jhonny'})
	.return('myNode')
	.fetch()
	.then((rows) => {
		console.log(rows) // => [{myNode: {id: 123, name: 'Jhonny'}}]
	})
	.catch((err) => console.error(err))
new Neo4jQuery()
	.match({$: 'myNode', name: 'Jhonny'})
	.return('myNode')
	.fetch('myNode')
	.then((rows)=>{
		console.log(rows) // => [{id: 1234, name: 'Jhonny'}]
	})
	.catch((err) => console.error(err))

fetchOne([extractAlias])

Returns the first record, if specified the result will be brought top-level accessing the alias given.

new Neo4jQuery()
	.match({$: 'myNode', name: 'Jhonny'}, {$: 'someoneElse', name: 'Bo'}))
	.return('myNode', 'someoneElse')
	.fetchOne()
	.then(row => {
		console.log(row) // => {myNode: {id: 1234, name: 'Jhonny'}, someoneElse: {...}}
	})
	.catch((err) => console.error(err))
new Neo4jQuery()
	.match({$: 'myNode', name: 'Jhonny'}, {$: 'someoneElse', name: 'Bo'})
	.return('myNode', 'someoneElse')
	.fetchOne('myNode')
	.then(row => {
		console.log(row) // => {id: 1234, name: 'Jhonny'}
	})
	.catch((err) => console.error(err))

run()

Runs the native run method of the driver returning unformatted results.

Use this method if you don't care about the result as it skips parsing of the result object.

example: Get the query result as the driver returns it

new Neo4jQuery()
	.match({$: 'myNode'})
	.return()
	.run()
	.then(queryResult => {
		console.log(queryResult)
	// 	{ records:
  //  [ Record {
  //      keys: [Array],
  //      length: 1,
  //      _fields: [Array],
  //      _fieldLookup: [Object] },
  //    Record {
  //      keys: [Array],
  //      length: 1,
  //      _fields: [Array],
  //      _fieldLookup: [Object] },
  //    Record {
  //      keys: [Array],
  //      length: 1,
  //      _fields: [Array],
  //      _fieldLookup: [Object] } ],
  // summary:
  //  ResultSummary {
  //    statement:
  //     { text: 'MATCH (node {name:{name0}}) RETURN node as node ',
  //       parameters: [Object] },
  //    statementType: 'r',
  //    counters: StatementStatistics { _stats: [Object] },
  //    updateStatistics: StatementStatistics { _stats: [Object] },
  //    plan: false,
  //    profile: false,
  //    notifications: [],
  //    server:
  //     ServerInfo {
  //       address: 'hobby-necdejfcclhegbkeceejghal.dbs.graphenedb.com:24786',
  //       version: 'Neo4j/3.3.0' },
  //    resultConsumedAfter: Integer { low: 1, high: 0 },
  //    resultAvailableAfter: Integer { low: 1, high: 0 } } }
	})
	.catch((err) => console.error(err))

How to run tests

This will test against an online test instance

npm test

This will test against a local instance - you'll need to set env vars.

WARNING: Make sure you are using a test database as this adds and deletes data!

npm run test-local