philippkueng / node-neo4j

Neo4j REST API wrapper for Node.js
MIT License
211 stars 44 forks source link

insert Node and ID showing NaN #28

Closed ctippur closed 10 years ago

ctippur commented 10 years ago

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.

philippkueng commented 10 years ago

Hi Shekar,

This was due to the fact that i made all the repairs but only pushed a new release vor the pre 2.0.0 version. have done the same now for the node-neo4j@2.0.0.RC2 release now. just install the newest version by typing npm install node-neo4j@2.0.0-RC2 and then it should correctly extract the _id. Sorry for this error.

Cheers, Phil

ctippur commented 10 years ago

Phil -

I am not aware of a way to install just a single node module on heroku - as it is all controlled via package.json.

I have this on package.json

"node-neo4j": "~2.0.0-RC2",

Would this work?

ctippur commented 10 years ago

I actually uncovered that I can go to a bash shell on heroku and I installed the RC2 version.

I am still seeing the same behavior.

2013-12-26T20:40:05.601340+00:00 app[web.1]: BEFORE .. 2013-12-26T20:40:05.601663+00:00 app[web.1]: { name: 'test3', 2013-12-26T20:40:05.601663+00:00 app[web.1]: type: 'global_category', 2013-12-26T20:40:05.601663+00:00 app[web.1]: cr_date: '2013-12-26T20:40:05.601Z', 2013-12-26T20:40:05.601663+00:00 app[web.1]: last_upd: '2013-12-26T20:40:05.601Z' } 2013-12-26T20:40:05.623059+00:00 app[web.1]: Inserting node index AFTER ..global_category 2013-12-26T20:40:05.623059+00:00 app[web.1]: { name: 'test3', 2013-12-26T20:40:05.623059+00:00 app[web.1]: last_upd: '2013-12-26T20:40:05.601Z', 2013-12-26T20:40:05.623059+00:00 app[web.1]: cr_date: '2013-12-26T20:40:05.601Z', 2013-12-26T20:40:05.623059+00:00 app[web.1]: type: 'global_category', 2013-12-26T20:40:05.623059+00:00 app[web.1]: _id: NaN } 2013-12-26T20:40:05.623520+00:00 app[web.1]: IN insertIndex .. global_category_index, NaN

philippkueng commented 10 years ago

I'd remove the ~ and then it should work. eg. "node-neo4j": "2.0.0-RC2",

The fact that it didn't work when installing it via the bash command is that you only make changes to the file-system but don't restart the process. As far as i know when restart though it reverts back to the old unedited version.

Anyway, if you set the new version in the package.json it should work now. Let me know if it did, otherwise a skype call might help.

freeeve commented 10 years ago

Worked for me. I've got a basic package.json over here:

https://github.com/wfreeman/mvcs/blob/master/node.js/philippkueng.node-neo4j/package.json

philippkueng commented 10 years ago

Thanks @wfreeman for validating. Btw. thanks for including node-neo4j next to the thingdom package. Really cool!

@ctippur did it work for you now? Otherwise, add me on skype: philipp.kueng so we can find that bug.

ctippur commented 10 years ago

Phil -

I am able to get _ID now. Thanks a lot.