Open ayhid opened 8 years ago
I'm not sure. =) What do you mean by "getting this object"? How are you printing that? Have you tried actually calling the methods in the documentation?
As is typical for JS classes, all methods are actually defined on the class's prototype. So perhaps you're just not seeing prototype methods depending on how you're printing that object.
Try following the documentation. Let me know if anything doesn't work. Hope that helps for now.
@aseemk I actually tried to call the query()
method first but I got an exception TypeError: undefined is not a function
, than I used a simple console.log() to print out my GraphDB object and see whether or not it contains some methods.
Maybe you are mistaken GraphDB.query ()
with GraphDB.cypher ()
because query is really no a function on the db object
@royipressburger you are right I was calling GraphDB.query()
instead of GraphDB.cypher()
Now I am having another error here is what I am calling:
GraphDB.cypher({
query: 'MATCH (n) RETURN n',
params: {},
},
callback
);
And I am getting this error:
TypeError: Object [object Object] has no method 'http' at GraphDatabase.module.exports.GraphDatabase.cypher (/node_modules/neo4j/lib-new/GraphDatabase.js:208:19)
@ayhid for me its abit hard to understand like that, Can you add the complete stacktrace and more code please?
@royipressburger thank you for your patience
here is what I am actually doing
const neo4j = require('neo4j');
const GraphDB = new neo4j.GraphDatabase('http://neo4j:neo4j@localhost:7474');
function callback(err, results) {
console.log('callback');
if (err) throw err;
var result = results[0];
if (!result) {
console.log('No user found.');
} else {
var user = result;
console.log(user);
}
};
Meteor.methods({
'graph.get': ()=> {
GraphDB.cypher({
query: 'MATCH (n) RETURN n',
params: {},
},
callback
);
}
})
and here is the error with the full stack trace
TypeError: Object [object Object] has no method 'http'
at GraphDatabase.module.exports.GraphDatabase.cypher (/node_modules/neo4j/lib-new/GraphDatabase.js:208:19)
at [object Object].artistGet (imports/api/server/artists/methods.js:22:17)
at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1704:12)
at packages/ddp-server/livedata_server.js:1617:18
at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
at Server.apply (packages/ddp-server/livedata_server.js:1616:45)
at Server.call (packages/ddp-server/livedata_server.js:1559:17)
at [object Object]:1:-54
at Script.(anonymous function) [as runInThisContext] (vm.js:41:22)
at .meteor/local/build/programs/server/shell-server.js:366:27
@ayhid Hi again.
So i just copied your code and ran it, everything looks Ok there..
The thing is I did not wrap it with Meteor.methods
, so i guess the problem is there somewhere..
I don't know Meteor so I'm sorry I cant help :\
UPDATE:
when looking at GraphDatabase.js
source code I see nothing related to the http
method..
So maybe try to delete the node modules and rerun npm install
? i doute it will work though
@royipressburger sorry for the delay, I have the 2.0.0-RC2 version and the GraphDatabase.js calls a http
method
I'm having the same issue with the same version. I posted here before coming across this issue: https://github.com/thingdom/node-neo4j/issues/204 - though I should say that the .cypher()
method does seem to work
I am testing the module within a meteor app, but I can't get further from instanciating the GraphDatabase Class.
As you can see I can't call any methods on this object as it does contain none.
Am I missing something?