Giter Club home page Giter Club logo

node-neo4j's Introduction

Neo4j REST API wrapper for Node.js

master branch: Build Status Dependency Status Coverage Status
develop branch: Build Status


Installation

npm install node-neo4j --save

Usage

In order to use the library you either have to create a heroku app and add the GrapheneDB Neo4j Addon or install it locally.
If you're using OS X I highly recommend installing Neo4j via Homebrew.

brew install neo4j
neo4j start

Instantiate a wrapper instance

var neo4j = require('node-neo4j');
db = new neo4j('http://username:password@domain:port');

// when using token based authentication introduced in Neo4j v2.2
db = new neo4j('http://:your-authentication-token@domain:port');

Run a cypher query

db.cypherQuery("START user = node(123) MATCH user-[:RELATED_TO]->friends RETURN friends", function(err, result){
    if(err) throw err;

    console.log(result.data); // delivers an array of query results
    console.log(result.columns); // delivers an array of names of objects getting returned
});

NOTE New features like labels, contraints and transactions are only supported by Neo4j 2.0.0.

Disclaimer We try to update the module as fast as possible to adapt to any new version of Neo4j. Don't be shy to give remarks, report bugs or send in pull requests. You can contact use on Twitter https://twitter.com/Stofkn, https://twitter.com/philippkueng or send us some email via the address defined in the package.json.

New features

Note

Take a look at the test.main.js file in the test folder for many examples.

Labels and indexes

insertNode Now supports labels.

readLabels Get the labels of a node given the node id. It returns an array of strings.

insertLabelIndex Create a label index on ONE property.

deleteLabelIndex Delete a label index for a property.

listLabelIndexes List indexes for a label.

addLabelsToNode Adding one or multiple labels to a node.

replaceLabelsFromNode Replacing all labels on a node by new labels.

deleteLabelFromNode Removing a label from a node.

readNodesWithLabel Get all nodes with a label.

readNodesWithLabelsAndProperties Get nodes by labels and properties.

listAllLabels List all labels.

updateNodesWithLabelsAndProperties Update all nodes with labels and properties and update/remove properties.

deleteNodesWithLabelsAndProperties Delete all nodes with labels and properties.

Constraints

createUniquenessContstraint Create a uniqueness constraint on a property.

readUniquenessConstraint Get a specific uniqueness constraint for a label and a property.

listAllUniquenessConstraintsForLabel Get all uniqueness constraints for a label.

listContraintsForLabel Get all constraints for a label.

listAllConstraints List all constraints.

dropUniquenessContstraint Drop uniqueness constraint for a label and a property.

Transactions

beginTransaction Begin a new transaction.

addStatementsToTransaction Execute statements in an open transaction.

resetTimeoutTransaction Reset transaction timeout of an open transaction.

commitTransaction Commit an open transaction.

rollbackTransaction Rollback an open transaction.

beginAndCommitTransaction Begin and commit a transaction in one request.

Changes

Node id is now an integer not a string. cypherQuery Now supports parameters, Neo4j will cache query and reuse it with different parameters.

Node operations

Insert a Node

db.insertNode({
    name: 'Darth Vader',
    sex: 'male'
},function(err, node){
    if(err) throw err;

    // Output node properties.
    console.log(node.data);

    // Output node id.
    console.log(node._id);
});

Read a Node

db.readNode(12, function(err, node){
    if(err) throw err;

    // Output node properties.
    console.log(node.data);

    // Output node id.
    console.log(node._id);
});

Update a Node

Will remove any assigned properties and replace them with the ones given below.

db.updateNode(12, {name:'foobar2'}, function(err, node){
    if(err) throw err;

    if(node === true){
        // node updated
    } else {
        // node not found, hence not updated
    }
});

Update all nodes with labels and oldProperties, set the newProperties and remove removeProperties Return nothing if returnUpdatedNodes is false. Default will return all updated nodes.

  • labels String|Array[String] e.g.: '' or [] or 'User' or ['User', 'Student']
  • 'oldProperties' Object e.g.: { userid: '124' }
  • newProperties Object e.g.: { email: '[email protected]' }
  • removeProperties Object e.g.: ['old_email', 'old_address'] (Optional)
  • returnUpdatedNodes Boolean e.g.: false (Optional, default: true)

Will change only the name and remove the old_address of user with userid '123'. The node will be returned in an array because returnUpdatedNodes is true. You can drop returnUpdatedNodes because it's optional and the default is true.

db.updateNodesWithLabelsAndProperties(['User'], { userid: '123' }, { name:'new_name' }, ['old_address'], true, function (err, updatedNodes){
    if(err) throw err;

    if(updatedNodes.length === 1){
        // one node updated
    } else {
        // zero or multiple nodes were updated
    }
});

Delete a Node

db.deleteNode(12, function(err, node){
    if(err) throw err;

    if(node === true){
        // node deleted
    } else {
        // node not deleted because not found or because of existing relationships
    }
});

Delete all nodes with labels and properties.

  • labels String|Array[String] e.g.: '', [], 'User', ['User', 'Student']

  • 'properties' Object e.g.: { userid: '124' } Returns the number of deleted nodes e.g.: 1.

    db.deleteNodesWithLabelsAndProperties('User',{ firstname: 'Sam', male: true }, function(err, deletedNodesCount){}); db.deleteNodesWithLabelsAndProperties(['User','Admin'], { 'name': 'Sam'}, function(err, deletedNodesCount){});

Relationship operations

Insert a Relationship

db.insertRelationship(root_node_id, other_node_id, 'RELATIONSHIP_TYPE', {
    age: '5 years',
    sideeffects: {
        positive: 'happier',
        negative: 'less time'
    }}, function(err, relationship){
        if(err) throw err;

        // Output relationship properties.
        console.log(relationship.data);

        // Output relationship id.
        console.log(relationship._id);

        // Output relationship start_node_id.
        console.log(relationship._start);

        // Output relationship end_node_id.
        console.log(relationship._end);
});

Read a Relationship

db.readRelationship(relationship_id, function(err, relationship){
    if(err) throw err;

    // Same properties for relationship object as with InsertRelationship
});

Update a Relationship

Will remove any assigned properties and replace them with the ones given below.

db.updateRelationship(relationship_id, {
        age: '6 years'
    }, function(err, relationship){
        if(err) throw err;

        if(relationship === true){
            // relationship updated
        } else {
            relationship not found, hence not updated.
        }
});

Delete a Relationship

db.deleteRelationship(relationship_id, function(err, relationship){
    if(err) throw err;

    if(relationship === true){
        // relationship deleted
    } else {
        // relationship not deleted because not found.
    }
});

Index operations

This documentation only contains calls to Node specific index functions however to call those functions for Relationships, just replace Node with Relationship.

Insert an Index

db.insertNodeIndex('the_index_name', function(err, result){
    if (err) throw err;

    console.log(result); // return the index template and configuration
});

// insert an index with a custom configuration
db.insertNodeIndex({
    index: 'the_index_name',
    config: {
        type: 'fulltext',
        provider: 'lucene'
    }
}, function(err, result){
    if (err) throw err;

    console.log(result); // return the index template with its custom configuration
});

Delete an Index

db.deleteNodeIndex('the_index_name', function(err, result){
    if (err) throw err;

    console.log(result) // will be true, if the deletion is successful
});

List all Indexes

db.listNodeIndexes(function(err, result){
    if (err) throw err;

    console.log(result); // an object with all indexes and their templates and configurations
});

Add a node to an index

db.addNodeToIndex(node_id, 'the_index_name', 'an_indexed_key', 'an_indexed_value', function(err, result){
    if (err) throw err;

    console.log(result); // will return the index
});

Advanced relationship operations

Get all relationship types used within the Neo4j database

Will also return types of those relationships that have been deleted.

db.readRelationshipTypes(function(err, result){
    if(err) throw err;

    console.log(result); // eg. ['RELATED_TO', 'LOVES', 'KNOWNS']
});

Get relationships of a node

Get all (incoming and outgoing) relationships of a node, or use the options object to filter for specifc types and directions.

db.readRelationshipsOfNode(node_id, {
    types: ['RELATED_TO', ...] // optional
    direction: 'in' // optional, alternative 'out', defaults to 'all'
    }, function(err, relationships) {
        if (err) throw err;

        console.log(relationships); // delivers an array of relationship objects.
});

Run a cypher query against Neo4j

db.cypherQuery("START user = node(123) MATCH user-[:RELATED_TO]->friends RETURN friends", function(err, result){
    if(err) throw err;

    console.log(result.data); // delivers an array of query results
    console.log(result.columns); // delivers an array of names of objects getting returned
});

Run a batch query against Neo4j

For more information about what queries are possible checkout the Neo4j REST API documentation.

db.batchQuery([
    {
        method: "GET",
        to: "/node/100",
        id: 0
    },{
        method: "GET",
        to: "/node/102",
        id: 1
    }
], function(err, result){
    if(err) throw err;

    console.log(result); // delivers an array of query results
});

Tests

This API wrapper relies on mocha for testing, therefore when you want to run the tests follow the steps below.

$ git clone git://github.com/philippkueng/node-neo4j.git
$ cd node-neo4j/
$ npm install
$ npm test

Issues or Feature Requests?

In case you run into an issue while using the wrapper or you have a feature request please let me know by creating a new issue or contacting me via twitter.

Development

When making a pull request, please make sure to make it against the develop branch and make sure to install the git pre-commit hook which enforces a shared coding style.

ln -s ../../pre-commit.sh .git/hooks/pre-commit

node-neo4j's People

Contributors

bibby avatar brian-gates avatar deedubs avatar freeeve avatar lazaruslarue avatar lyip1992 avatar mattbasta avatar oskarhane avatar philippkueng avatar stofkn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-neo4j's Issues

node-neo4j on heroku instance

Hello -

I am having trouble inserting node on neo4j hosted on heroku.

I am able to add index but when I call db.insertNode, I see that it is not inserting data. It just creates a node (without any payload).

I have adb connection like this..
db = new neo4j(''http://USER:[email protected]:7789' || http://localhost:7474');

As you can see, the below snippet throws data when used locally but not on heroku

db.insertNode(node,function(err, node){
if(err) throw err;
console.log('Inserting node..');
console.log(node);
insertIndex (node, index_name, cb);
});

Appreciate any help in resolving this issue. I am losing sleep over this.

  • Shekar

Update and Replace [non issue - request]

The functionality of the Update node behaves as if it was Replace.

It would be nice to have two methods one Replace (Current Update) and one Update. The Update method would basically only update the properties that are specified in the passed in object - leaving the other non specified ones intact.

I am request this change, as I could not find a way to update only certain properties of a particular using this module.

server as a cypher query proxy. [Related to #45]

Hi Philippueng, SInce I am new to the AngularJS framework, May be my question may not make sense.

I tried working with the Neo4J endpoints rest api's but the response JSON I get has too much in it.
Your package is way much cleaner and return the JSON that is readable and returns of only what is being queried by Cyhper queries and that attracts me to use your package.

In the comments for #45 you suggested following and I quote

"What however works if you use node-neo4j with a server side framework like express or hapi and expose certain resources via REST to your Angular application. Alternatively if you don't want to completely stub out a REST API you can also use the server as a cypher query proxy that way."

How can I use the server as a cypher query proxy?
Will appreciate your suggestions.
Regards
DKSFCB

Any support for Promise?

Its very hard to go back to callbacks specially after being spoiled with async await.

Is there any way to use promise?

Are there any known issues with Bluebird.promisifyAll() ?

updateNode should update not replace node's all properties

I need to update a node's existing properties. I have node's id but, currently updateNode function replaces all properties of the node with the given properties. But I think it should really update/add properties.
describe('-> Replace an existing Node with a simple object, check if alias works', function () {
it('should return true', function (done) {
db.updateNode(node_id, {
name: 'foobar2'
}, function (err, result) {
isTrue(err, result);
done();
});
});
});

At least there should be "updateNodeProperties" function that takes "node_id" and properties and simply appends/replaces existing props to the existing node.

Test suite does not succeed on Neo4j 2.3.0

I am getting following error when i execute test case using node 4.2.2 and Neo4j 2.3.0

  1. Testing Node specific operations for Neo4j
    => Create a Node -> A first simple valid node insertion with no labels should return the JSON for this node:
    Uncaught AssertionError: expected [Error: Response body is empty] to not exist
    at onlyResult (/Users/redpanda/work/github/node-neo4j/test/test.main.js:14:16)
    at /Users/redpanda/work/github/node-neo4j/test/test.main.js:65:21
    at /Users/redpanda/work/github/node-neo4j/lib/main.js:52:6
    at Request.callback (/Users/redpanda/work/github/node-neo4j/node_modules/superagent/lib/node/index.js:748:3)
    at Request. (/Users/redpanda/work/github/node-neo4j/node_modules/superagent/lib/node/index.js:135:10)
    at emitOne (events.js:77:13)
    at Request.emit (events.js:169:7)
    at IncomingMessage. (/Users/redpanda/work/github/node-neo4j/node_modules/superagent/lib/node/index.js:938:12)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:905:12)
    at doNTCallback2 (node.js:441:9)
    at process._tickCallback (node.js:355:17)

  2. Testing Node specific operations for Neo4j
    => Delete a Node "before all" hook:
    Uncaught AssertionError: expected [Error: Response body is empty] to not exist
    at onlyResult (/Users/redpanda/work/github/node-neo4j/test/test.main.js:14:16)
    at /Users/redpanda/work/github/node-neo4j/test/test.main.js:228:17
    at /Users/redpanda/work/github/node-neo4j/lib/main.js:52:6
    at Request.callback (/Users/redpanda/work/github/node-neo4j/node_modules/superagent/lib/node/index.js:748:3)
    at Request. (/Users/redpanda/work/github/node-neo4j/node_modules/superagent/lib/node/index.js:135:10)
    at emitOne (events.js:77:13)
    at Request.emit (events.js:169:7)
    at IncomingMessage. (/Users/redpanda/work/github/node-neo4j/node_modules/superagent/lib/node/index.js:938:12)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:905:12)
    at doNTCallback2 (node.js:441:9)
    at process._tickCallback (node.js:355:17)

Cypher query that only returns strings (with null value)

I have a cypher query that returns a bunch of strings, some of which could be null. I receive an error

TypeError: Cannot read property 'self' of null
at Neo4j.addNodeId

when attempting to run the query. My query is like the below:

start v=node(*) where n.nodetype! ='venue'
with v match v-[r1?:IN_REGION]->city-[r2?:IN_REGION]->province-[r3?:IN_REGION]->country
return v.name,city.name,province.name,country.name

The query runs fine in the neo4j console. Any ideas?

npm install failing

after trying to install npm install using
"npm install node-neo4j"

I get the following spill


npm ERR! Failed to parse json
npm ERR! Unexpected token }
npm ERR! File: /Users/edited/code/alpha_0.1/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "node-neo4j"
npm ERR! cwd /Users/path edited/code/alpha_0.1
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.3.5
npm ERR! file /hidden path edited/code/alpha_0.1/package.json
npm ERR! code EJSONPARSE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /path edited/code/alpha_0.1/npm-debug.log
npm ERR! not ok code 0

Working with transactions

Hi, it should be possible to get statements from the actions (insertNode..) to use your transaction api effectively.

e.g

//Insert node and get the statement
var statement = db.insertNode({
    name: 'Darth Vader',
    sex: 'male'
},function(err, node){
    if(err) throw err;

    // Output node properties.
    console.log(node.data);

    // Output node id.
    console.log(node._id);
});
//Begin transaction
var id = db.beginTransaction(callback, statement);
db.commitTransaction(id, callback);

//...or similiar

Create unique node

How do I create unique node in neo4j?
I have model for user, and It has property like UserID, UserName, EMailID, Mobile, Address, Zipcode ect...
I want to create unique node for about user. I have UserID, UserName, EMailID, Mobile as unique field. so, when same UserID or any field mention here is trying to enter again, it should be return as error. It it possible?

Cross-Origin Resource Sharing (CORS) support

I was trying to browserify this package so can quickly prototype some client side app without having to setup a server (apart from neo4j itself). Looking at these stackoverflow comments there is a problem with the neo4j server with the old cypher endpoint but everything should work fine with the transactional endpoint.

http://stackoverflow.com/a/26976950/1833322
http://stackoverflow.com/a/26686262/1833322 (comment)

so i just tried

var db = new neo4j('http://neo4j:neo4j@localhost:7474');
db.beginTransaction();

as i was guessing the beginTransaction function would do something with the transactional endpoint. But i'm still getting the CORS error:

XMLHttpRequest cannot load http://localhost:7474/db/data/transaction. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 401.

Double Insert.

Hi guys,

I am experiencing a strange situation. Randomly to insert a record in the database is a "double insert", the record is added twice. I've used setTimeout node in order to avoid problems of double click. If I click several times in the time to insert a record in the database setTimeout works, do not let me enter multiple, is just working. Any suggestions? I'm doing my requests via Jquery.

Thank

Running Cypher query.

Hi,

I used this library to create my neo4j graph and it worked well.

Now, I would like to query it thanks to a cypher query.
The fact is I would like to run this query :

    START d=node(47), e=node(98)
MATCH p = shortestPath( d-[*..15]->e )
RETURN p;

But I always got this error when I'm executing it thanks to the library

      throw arguments[0];
                   ^
TypeError: Cannot call method 'replace' of undefined
at Neo4j.addNodeId (/Users/guillaumelefloch/Documents/workspace/Projet-           BMA/BmaServeur/node_modules/node-neo4j/main.js:350:25)
at Neo4j.cypherQuery.request.post.set.send.end.result.body.data (/Users/guillaumelefloch/Documents/workspace/Projet-BMA/BmaServeur/node_modules/node-neo4j/main.js:307:42)
at Array.forEach (native)
at Function.addIds (/Users/guillaumelefloch/Documents/workspace/Projet-BMA/BmaServeur/node_modules/node-neo4j/main.js:306:50)
at next (/Users/guillaumelefloch/Documents/workspace/Projet-BMA/BmaServeur/node_modules/node-neo4j/node_modules/step/lib/step.js:51:23)
at Step (/Users/guillaumelefloch/Documents/workspace/Projet-BMA/BmaServeur/node_modules/node-neo4j/node_modules/step/lib/step.js:122:3)
at Request.Neo4j.cypherQuery [as callback] (/Users/guillaumelefloch/Documents/workspace/Projet-BMA/BmaServeur/node_modules/node-neo4j/main.js:303:25)
at Request.<anonymous> (/Users/guillaumelefloch/Documents/workspace/Projet-BMA/BmaServeur/node_modules/node-neo4j/node_modules/superagent/lib/node/index.js:130:10)
at Request.EventEmitter.emit (events.js:96:17)
at IncomingMessage.Request.end (/Users/guillaumelefloch/Documents/workspace/Projet-BMA/BmaServeur/node_modules/node-neo4j/node_modules/superagent/lib/node/index.js:566:12)

Do you know what could my problem be? and if there is an other to realise what I want?

Thanks!

insertNode() ERR with very large batch operations

Trying to batch insert a lot of data with versions of this(a), or a timeout-wrapped version(b):

var A_batchInsert = function(arrObject) {
  for (var i = 0; i < arrObject.length; i++) {
    db.insertNode(arrObject[i],['LabelName'], cb);
  }
};
var B_batchInsert = function(arrObject) {
  for (var i = 0; i < arrObject.length; i++) {
    setTimeout(db.insertNode(arrObject[i],['LabelName'], cb), 10);
  }
};

My file has something like 7000 lines, and returns the below error. Works fine when I include only 50 or so lines of the file.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: connect EMFILE
    at errnoException (net.js:901:11)
    at connect (net.js:764:19)
    at net.js:842:9
    at asyncCallback (dns.js:68:16)
    at Object.onanswer [as oncomplete] (dns.js:121:9)

File format is like this:

var arrObject = [
  {"val":"salt","description":"salt_desc","term":"salt_term"},
  {"val":"sugar","description":"sugar_desc","term":"sugar_term"},
  {"val":"butter","description":"butter_desc","term":"butter_term"},
  {"val":"onion","description":"onion_desc","term":"onion_term"}
];

Graphenedb_url authentication returns error 403

I'm using node-neo4j. And I when I test using localhost:7474 I passed neo4j:mypassword@localhost:7474 and it worked but when i'm trying to use graphenedb the url looks like this app45353535:sdddgt3434c645e5@app45353535:dodgers.fd54f4444d:35454 but it returns error 403 but when I take all the parameters after the @ and paste on the browser, it takes me to the neo4j db

simple insert not working on GrapheneDB

I tried this simple insert sample using node-neo4j driver with db hosted on GrapheneDB.

var neo4j = require('node-neo4j');

db = new neo4j('http://user:[email protected]:24789');

db.insertNode({
    name: 'Darth Vader',
    sex: 'male'
},function(err, node){
    if(err) throw err;

    console.log(node.data);

    console.log(node._id);
});

The program fails to execute and gives out an error:

Error: Response body is empty
at /home/pranavpunjabi/node_modules/node-neo4j/lib/main.js:52:15
at Request.callback (/home/pranavpunjabi/node_modules/node-neo4j/node_modules/superagent/lib/node/index.js:748:3)
at Request. (/home/pranavpunjabi/node_modules/node-neo4j/node_modules/superagent/lib/node/index.js:135:10)
at Request.emit (events.js:109:17)
at IncomingMessage. (/home/pranavpunjabi/node_modules/node-neo4j/node_modules/superagent/lib/node/index.js:938:12)
at IncomingMessage.emit (events.js:131:20)
at _stream_readable.js:910:16
at process._tickCallback (node.js:358:11)

Am I using this driver correctly?

Error: read ECONNRESET parse file and insert node

Hello,

I have a file with 32 000 lines and I want to use each one for create a node (use the insertNode function but I have same problem when I change by Cypher method. With small files I have no problem but when have a lot of line I have an error :

events.js:72
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at errnoException (net.js:904:11)
at TCP.onread (net.js:558:19)

For load and read the file I use fast-csv

Thanks for your help.

Cypher query returing null data

Phil

Sorry to bug you again.

I am not sure if I am doing anything wrong but the below query on graphenedb results with the right data:

n = node:global_category_index('name:"test4" AND type:"test_category" ') return n

results in

name test4
type test_category
cr_date 2013-12-24T19:01:52.904Z
last_upd 2013-12-24T19:01:52.904Z

However, when I use db.cypherQuery(cypherQuery, function(err, result) ...

I get no data.

2013-12-29T18:33:22.657726+00:00 app[web.1]: RESULT OF CYPHER QUERY
2013-12-29T18:33:22.659600+00:00 app[web.1]: { columns: [ 'n' ], data: [] }

Can you please take a look?

  • Shekar

code cleanup and getting the library ready for the new 2.0.0 release

So far all tests from our 2.0.0-RC1 release are also passing for 2.0.0-GA of neo4j.

However there are still a couple of things that should be refined before we make a proper release.

  • like commit to a coding standard and format the files accordingly
  • and try to fix as many old unit tests as possible. or at least make a list of the ones that are broken.

Update NPM

I think your NPM package is out of date. The one I received doesn't have the ability to add indexes, for example.

Fix broken tests for 2.0.0-RC1 compatibility

The broken tests are:

  1) Testing Node specific operations for Neo4j
  => Insert an Index -> Insert a non existing index on ONLY ONE property of a label should return the index:
     Uncaught AssertionError: expected { label: 'Person', property_keys: [ 'firstname' ] } to have a property 'property-keys'
      at Object.Assertion.property (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/should/lib/should.js:632:12)
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/test/test.main.js:631:25
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/main.js:295:6
      at Request.callback (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:630:3)
      at Request.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:131:10)
      at Request.EventEmitter.emit (events.js:95:17)
      at IncomingMessage.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:773:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:910:16
      at process._tickCallback (node.js:415:13)

    2) Testing Node specific operations for Neo4j
  => Replace all Labels on a Node -> Replace all labels by multiple new labels should return true if the labels were successfully changed:
     Uncaught AssertionError: expected [ 'Dutch', 'French', 'German' ] to have a length of 4 but got 3
      at Object.Assertion.length (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/should/lib/should.js:607:10)
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/test/test.main.js:920:26
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/main.js:89:5
      at Request.callback (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:630:3)
      at Request.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:131:10)
      at Request.EventEmitter.emit (events.js:95:17)
      at IncomingMessage.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:773:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:910:16
      at process._tickCallback (node.js:415:13)

    3) Testing Node specific operations for Neo4j
  => createUniquenessContstraint: Create a uniqueness constraint on a property -> Create a new uniqueness constraint on a property should return JSON for this constraint:
     Uncaught AssertionError: expected { label: 'User', type: 'UNIQUENESS', property_keys: [ 'email' ] } to have a property 'property-keys'
      at Object.Assertion.property (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/should/lib/should.js:632:12)
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/test/test.main.js:1298:25
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/main.js:728:6
      at Request.callback (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:630:3)
      at Request.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:131:10)
      at Request.EventEmitter.emit (events.js:95:17)
      at IncomingMessage.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:773:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:910:16
      at process._tickCallback (node.js:415:13)

    4) Testing Node specific operations for Neo4j
  => readUniquenessConstraint: Get a specific uniqueness constraint for a label and a property -> Get a specific uniqueness constraint for a label and a property should return an array with one uniqueness constraint:
     Uncaught AssertionError: expected { property_keys: [ 'email' ], label: 'User', type: 'UNIQUENESS' } to have a property 'property-keys'
      at Object.Assertion.property (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/should/lib/should.js:632:12)
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/test/test.main.js:1359:28
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/main.js:760:5
      at Request.callback (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:630:3)
      at Request.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:131:10)
      at Request.EventEmitter.emit (events.js:95:17)
      at IncomingMessage.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:773:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:910:16
      at process._tickCallback (node.js:415:13)

    5) Testing Node specific operations for Neo4j
  => listAllUniquenessConstraintsForLabel: Get all uniqueness constraints for a label -> Get all uniqueness constraints should return an array with two uniqueness constraints:
     Uncaught AssertionError: expected { property_keys: [ 'uid' ], label: 'User', type: 'UNIQUENESS' } to have a property 'property-keys'
      at Object.Assertion.property (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/should/lib/should.js:632:12)
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/test/test.main.js:1435:28
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/main.js:794:5
      at Request.callback (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:630:3)
      at Request.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:131:10)
      at Request.EventEmitter.emit (events.js:95:17)
      at IncomingMessage.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:773:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:910:16
      at process._tickCallback (node.js:415:13)

    6) Testing Node specific operations for Neo4j
  => listAllConstraintsForLabel: Get all constraints for a label -> Get all constraints for a User should return an array with two constraints:
     Uncaught AssertionError: expected { property_keys: [ 'uid' ], label: 'User', type: 'UNIQUENESS' } to have a property 'property-keys'
      at Object.Assertion.property (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/should/lib/should.js:632:12)
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/test/test.main.js:1496:28
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/main.js:794:5
      at Request.callback (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:630:3)
      at Request.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:131:10)
      at Request.EventEmitter.emit (events.js:95:17)
      at IncomingMessage.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:773:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:910:16
      at process._tickCallback (node.js:415:13)

    7) Testing Node specific operations for Neo4j
  => listAllConstraints: Get all constraints -> Get all constraints should return an array with two constraints:
     Uncaught AssertionError: expected { property_keys: [ 'pid' ],
    label: 'Product',
    type: 'UNIQUENESS' } to have a property 'property-keys'
      at Object.Assertion.property (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/should/lib/should.js:632:12)
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/test/test.main.js:1557:28
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/main.js:859:5
      at Request.callback (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:630:3)
      at Request.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:131:10)
      at Request.EventEmitter.emit (events.js:95:17)
      at IncomingMessage.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:773:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:910:16
      at process._tickCallback (node.js:415:13)

    8) Testing Node specific operations for Neo4j
  => Test Cyper Query Functionality against non existing nodes -> Run the cypher query from issue 8 by @electrichead against non existing nodes should return empty data array since no data matches the query:
     Uncaught AssertionError: expected [Error: HTTP Error 400 when running the cypher query against neo4j.
  Question mark is no longer used for optional patterns - use OPTIONAL MATCH instead (line 1, column 31)
  "start a=node(*) with a match a-[r1?:RELATED_TO]->o return a.name,o.name"
                               ^] to not exist
      at onlyResult (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/test/test.main.js:10:13)
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/test/test.main.js:2120:6
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/main.js:1380:6
      at Request.callback (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:630:3)
      at Request.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:131:10)
      at Request.EventEmitter.emit (events.js:95:17)
      at IncomingMessage.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:773:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:910:16
      at process._tickCallback (node.js:415:13)

    9) Testing Node specific operations for Neo4j
  => Test Cypher Query Functionality against existing nodes and relationships -> Run the cypher query from issue 8 by @electrichead against non existing nodes should return a valid response:
     Uncaught AssertionError: expected [Error: HTTP Error 400 when running the cypher query against neo4j.
  Question mark is no longer used for optional patterns - use OPTIONAL MATCH instead (line 1, column 24)
  "START a=node(*) match a-[r1?:RELATED_TO]->o RETURN a.name,o.name"
                        ^] to not exist
      at onlyResult (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/test/test.main.js:10:13)
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/test/test.main.js:2220:6
      at /Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/main.js:1380:6
      at Request.callback (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:630:3)
      at Request.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:131:10)
      at Request.EventEmitter.emit (events.js:95:17)
      at IncomingMessage.<anonymous> (/Users/philippkung/Documents/Programmieren/Nodejs/node-neo4j/node_modules/superagent/lib/node/index.js:773:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:910:16
      at process._tickCallback (node.js:415:13)

Looking for AngularJS support

Can you please add support in node-neo4j to be used in AngularJS or suggestion on how to use the existing package in AngularJS

Thanks in advance.

insert Node and ID showing NaN

Phil -

This is Shekar again. I managed to point the database to graphenedb.

I have a issue. When I insert a node
console.log('BEFORE ..' + node.type);
console.log(node);
db.insertNode(node,function(err, node){
if(err){
cb("Error while inserting ",{data: err});
throw err;
}else{
console.log('AFTER..' + node.type);
console.log(node);
insertIndex (node, index_name, cb);
}
});
I see that the ID I get back has a NaN

Here is the console log:

2013-12-26T07:26:57.026340+00:00 app[web.1]: { name: 'test1',
2013-12-26T07:26:57.026340+00:00 app[web.1]: type: 'test_category',
2013-12-26T07:26:57.026340+00:00 app[web.1]: cr_date: '2013-12-26T07:26:57.020Z',
2013-12-26T07:26:57.026340+00:00 app[web.1]: last_upd: '2013-12-26T07:26:57.020Z' }
2013-12-26T07:26:57.051993+00:00 app[web.1]:AFTER ..test_category

2013-12-26T07:26:57.054481+00:00 app[web.1]: { name: 'test1',
2013-12-26T07:26:57.054481+00:00 app[web.1]: last_upd: '2013-12-26T07:26:57.020Z',
2013-12-26T07:26:57.054481+00:00 app[web.1]: cr_date: '2013-12-26T07:26:57.020Z',
2013-12-26T07:26:57.054481+00:00 app[web.1]: type: 'test_category',
2013-12-26T07:26:57.054481+00:00 app[web.1]: _id: NaN }

When I query graphenedb, I see that I get a ID for query ..

start n = node:global_category_index('name:"test1" AND type:"test_category" ')

I get, "id":"69134"

Could this be due to any other issue? I am using Neo4j 2.0.0 version.

  • Shekar

create unique index

How can I create unique index? I don't want to insert duplicate records in neo4j.
My User Model has some unique fields like (UserID, UserName, EMailID, MobileNo )
I want all fields in neo4 with unique index.

Params in cypher query

I was trying to use params in a cypher query and discovered that cypherQuery doesn't actually send params at all. I've gotten around this via:

Neo4j.prototype.cypherQuery = function(query, params, callback){
var that = this;

// backward compatibility
if ((typeof(callback) == 'undefined') && (typeof(params) == 'function')) {
    callback = params;
    params = {};
}

request
    .post(that.url + '/db/data/cypher')
    .set('Content-Type', 'application/json')
    .send({
        query: query,
        params: params || {}
    })

Rename Method or Create a correct one

This method "createUniquenessContstraint" has a typo in it. Should be "...Constraint"
I think it should be corrected or, at least, create a correct named one which could invoke this one in the back.
But as recently you cleaned up your code, you could include this change in your next cleanup.

Improve Request Error Handling

When a neo4j server is down for whatever reason, this module doesn't handle the ECONNREFUSED error- the entire node process exits, which makes it very difficult to return an error to the client. I'm working on a PR for this, but here's what I'm thinking of doing:

Change request callback arity from function(result) { to function(err, result) { This lets us catch ECONNREFUSED errors before they cause node to exit. I'll also have to handle the case where result is null in all functions that make HTTP requests.

Better handling of cypher query results

Right now when 'cypherQuery' call results in a multi-dimensional array that requires knowing all positions of the data in the result set. For example when executing "[...] RETURN user, roles" I would ideally expect accessing data in the callback via some getters, similar to the following: "result.data[0].user" or "result.data[1].roles" without the need using "result.columns" for that. This should greatly simplify scenarios related to raw cypher query calls.

Transactional endpoint error handling

Hi,

as described in the documentation (http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-handling-errors) the server always returns a statuscode of 200 or 201. At the moment only the statuscode determines whether an error occured or not, which is pointless because the server only returns "success".
So you should check if the result.body.errors array is empty to verify that no errors occured.
Also in the current implementation if the server returns 404, indicating that the transaction doesnt exist, the callback function gets called -> callback(null, false); // Transaction doesn't exist.
I think if something went wrong with the transaction its better to pass a new error to the callback.

Cypher query response rows flattened.

When I execute a cypher query with Neo4j.prototype.cypherQuery, the data results come back with the rows all flattened into one array, when I would have expected an array of rows, each of which should be an array of column values.

Here's a minimal example from my http://localhost:7474/webadmin/#/console/http session:

http> POST /db/data/cypher {"query":"create (:ex {p1: 1, p2: 2}), (:ex {p1: 3, p2: 4})", "params":{}}
==> 200 OK
==> {
==>   "columns" : [ ],
==>   "data" : [ ]
==> }
http> POST /db/data/cypher {"query":"match (n:ex) return n.p1, n.p2", "params":{}}
==> 200 OK
==> {
==>   "columns" : [ "n.p1", "n.p2" ],
==>   "data" : [ [ 1, 2 ], [ 3, 4 ] ]
==> }

With [email protected]

neoConnection.cypherQuery("match (n:ex) return n.p1, n.p2", {}, function(err, results){
  console.log(results);
});
//=> { columns: [ 'n.p1', 'n.p2' ], data: [ 1, 2, 3, 4 ] } 

saving arrays

the insertion query fails if an array field is empty (although the db supports it)

db.insertNode({ name: ['Darth', 'Vader'], sex: 'male' }, function(){
  // works
});

db.insertNode({ name: [], sex: 'male' }, function(){
  // doesn't work
});

also it seems to me that it escapes arrays on node update, making it impossible to store arrays in db?

Node IDs are NaN if credentials in the connection URL contain an uppercase letter

Here's a temporary fix I applied in my own codebase to make addNodeId work:

var neo4j = require('node-neo4j');
/**
 * Monkey patch the removeCredentials to get node._id and rel._id working.
 * From http://www.w3.org/Addressing/URL/url-spec.txt:
 * user      -> alphanum2 [ user ]  
 * password  -> alphanum2 [ password ] 
 * alphanum2 -> alpha | digit | - | _ | . | +  
 * alpha     -> a|...|z|A|...|Z
 * digit     -> 0|...|9
 */
neo4j.prototype.removeCredentials = function(path) {
    if(typeof path !== 'undefined' && path !== ''){
        return path.replace(/[a-zA-Z0-9_.+-]+\:[a-zA-Z0-9_.+-]+\@/, '');
    } else {
        return '';
    }
};

The problem came up when I started using www.graphenedb.com, it automatically generates passwords like this:
http://my-db:[email protected]:12345

Also note that most usernames can contain dash and underscore, and the "more secure" passwords can contain weird characters like: !, *, $, % etc.
These weird characters are working when connecting using new neo4j(<url>), the trick is to escape them via %xx.

The above monkeypatch works as is, but I think it would be nice if a library didn't assume anything about the username and password of an application. Also my guess is that it is possible to use international hostnames as well.

So to be open I'd suggest something like:

var conn = url.parse(path);
delete conn.auth; // or conn.auth = undefined;
return url.format(conn);

... and probably do removeCredentials in the constructor and cache it.

bug installation

Hi,
I had problems installing. following error message

npm http GET https://registry.npmjs.org/node-neo4j
npm http 304 https://registry.npmjs.org/node-neo4j
npm http GET https://registry.npmjs.org/superagent/0.15.5
npm http GET https://registry.npmjs.org/step/0.0.5
npm http 304 https://registry.npmjs.org/superagent/0.15.5
npm http 304 https://registry.npmjs.org/step/0.0.5
npm http GET https://registry.npmjs.org/qs/0.6.5
npm http GET https://registry.npmjs.org/formidable/1.0.14
npm http GET https://registry.npmjs.org/mime/1.2.5
npm http GET https://registry.npmjs.org/emitter-component/1.0.0
npm http GET https://registry.npmjs.org/methods/0.0.1
npm http GET https://registry.npmjs.org/cookiejar/1.3.0
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/reduce
npm http 304 https://registry.npmjs.org/qs/0.6.5
npm http 304 https://registry.npmjs.org/mime/1.2.5
npm http 304 https://registry.npmjs.org/methods/0.0.1
npm http 304 https://registry.npmjs.org/formidable/1.0.14
npm http 304 https://registry.npmjs.org/emitter-component/1.0.0
npm http 304 https://registry.npmjs.org/cookiejar/1.3.0
npm http 304 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/reduce
npm ERR! notarget No compatible version found: reduce@'RedVentures/reduce#346d59'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.1.0","0.1.2"]
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! System Linux 3.11.0-15-generic
npm ERR! command "node" "/usr/local/bin/npm" "install" "node-neo4j"
npm ERR! cwd /home/dasaievgama/Documentos/gama-ca
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.25
npm ERR! code ETARGET
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/dasaievgama/Documentos/gama-ca/npm-debug.log
npm ERR! not ok code 0

Inserting relationship returns 405 error..

Hi,

The changes you've done on your library are working well! Thanks!

I have an other problem... I write some scripts to create relationship in my graph.
There are all working except one which sometimes returns 405 error and sometimes is working..

I'm doing a for loop and I'm inserting a lot of relationship in the same time .. and there is the problem ... Some data are inserting but some are not ..

Maybe i need to insert a timer between all those inserts?

labels

Now that labels have been implemented and the REST api supports them with some functions, shouldn't these be implemented?

Error Message Depth

Hey!

Firstly, awesome job on this module.

So before I offer a pull request, wanted to know if you guys would be open to having the error message in the cypherQuery include more detail. Currently, it creates a new Error message and returns the status code "callback(new Error('HTTP Error ' + result.statusCode + ' when running the cypher query against neo4j'), null);" which doesn't tell much. Easily the actual error message can be included. Thoughts?

Multi-return issues

There is a bug with the following query which I presume to be related to the multi-column return:

START r=relationship(*) MATCH (s)-[r]->(t) RETURN *

curl -H "Content-type: application/json" "http://localhost:7474/db/data/ext/CypherPlugin/graphdb/execute_query" - '{"query": "START r=relationship(*) MATCH (s)-[r]->(t) RETURN s,r,t"}'

results in: http://pastie.org/private/cqdg2ci4uzqiurfwkmza

db.cypherQuery('START r=relationship(*) MATCH (s)-[r]->(t) RETURN *', function(err, result){
console.log(result);
}

results in: http://pastie.org/private/qn6zkbnfr2io4kefq3m3vq

ListNodeIndexes return value when neo4j has no index.

Hey,

Just wondering about listAllIndexes behavior when the GraphDB has no index.
Got this error when calling listNodeIndexes:

throw err;
         ^
Error: HTTP Error 204 when listing all indexes.
    at ~/dev/mappingsMMtest/node_modules/node-neo4j/main.js:455:14
    at Request.callback (~/dev/mappingsMMtest/node_modules/node-neo4j/node_modules/superagent/lib/node/index.js:656:3)
    at Request.<anonymous> (~/dev/mappingsMMtest/node_modules/node-neo4j/node_modules/superagent/lib/node/index.js:131:10)
    at Request.EventEmitter.emit (events.js:95:17)
    at ClientRequest.<anonymous> (~/dev/mappingsMMtest/node_modules/node-neo4j/node_modules/superagent/lib/node/index.js:786:12)
    at ClientRequest.EventEmitter.emit (events.js:95:17)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1688:21)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
    at Socket.socketOnData [as ondata] (http.js:1583:20)
    at TCP.onread (net.js:525:27)

Is it something that should be handled by Neo4j ?
Is there a reason for this ?
Would returning an empty object, "false" or anything that would inform the user that no content was found be better than causing this error ?

If yes, I would be happy to change the listIndexes method and make a pull request.

Thomas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.