thingdom / node-neo4j

[RETIRED] Neo4j graph database driver (REST API client) for Node.js
Apache License 2.0
925 stars 135 forks source link

basic example fails #204

Closed ekkis closed 8 years ago

ekkis commented 8 years ago

so I did this:

$ node
> var neo=require('neo4j')
undefined
> var db=new neo.GraphDatabase('http://localhost:7474/')
undefined
> db.createNode({hello: 'world'})
TypeError: db.createNode is not a function
    at repl:1:4
    at REPLServer.defaultEval (repl.js:248:27)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:412:12)
    at emitOne (events.js:82:20)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:210:10)
    at REPLServer.Interface._line (readline.js:549:8)
    at REPLServer.Interface._ttyWrite (readline.js:826:14)

I'm running against community-2.2.5 with 2.0.0.-RC2 of the plugin. what am I missing?

aravindkarnam commented 8 years ago

ekkis, I found the following lines in the documentation......... "Also importantly, there's no more notion of persistence or updating (e.g. no more save() method) in this v2 API. If you want to update data and persist it back to Neo4j, you do that the same way as you would without these objects. This driver is not an ORM/OGM. Those problems must be solved separately." I guess they removed db.createNode form version2. We have to open a session and save node to database through cypher queries. Like they said this is not meant to be used as OGM. Hope this helps

aseemk commented 8 years ago

I'm sorry I missed this issue, @ekkis! And thank you @aravindkarnam for chiming in.

@ekkis: your issue is simply that you're looking at the old v1 docs for the basic example. The v2 docs are here:

https://github.com/thingdom/node-neo4j/tree/v2#readme

This is my fault though: I haven't merged the v2 branch yet, so the default GitHub page is still showing v1 docs. I added the note at the top though, but I guess that wasn't obvious either?

Hope this helps, and apologies again for the delay!

ekkis commented 8 years ago

yes, it took me a bit to figure out that there were other branches I should have been looking at