Closed MycChiu closed 10 years ago
Hi, If you are not using the same code as in the quick start section of the readme file, can you post the code your using ?
If you are using the same code, then there is some quick fix you can do as a temporary fix. We are still working on simplifying everything.
var Grex = require('grex');
var settings = {
'graph': 'tinkergraph',
'host': 'localhost',
'port': 8182
};
// 1. connect() takes two optional parameters: a settings Object and a Node style callback
Grex.connect(settings, function(err, client) {
if (err) {
console.error(err);
}
// 2. Initialize a Gremlin object to work with
var gremlin = client.gremlin();
// Start appending some code
var query = gremlin.g.v(1);
// and chaining...
query.has('age', 29);
// And you can do multiple different queries
var query2 = gremlin.g.v(5);
// 3. Send script for execution, and return a response with the results (if any)
query.gremlin.exec(function(err, response) {
console.log("query 1:", err, response);
});
query2.gremlin.exec(function(err, response) {
console.log("query 2:", err, response);
});
});
As shown in this example you should store the query in a variable which you can chain other element to it afterwords and then execute the query by getting the gremlin object in the query variable:
query.gremlin.exec(function(err, results) {
//....
});
Hope this answers your question. Regards.
Hi, It worked! Thank you so much! just a bit of suggestion, do you think it would be a good idea to temporarily replace the current quick start example with this one you provided here? so others won't be stuck as i did. Regards.
Hi, thanks for your feedback! This is definitely something that needs to be addressed. I'll try to provide a fix soon.
Hi, I tried to perform the simple vertex call by id (with nodejs) just like it's shown in the getting started section, but the rexster server responded with
message: 'no scripts provided' then I called console.log(gremlin) and the script was really empty.
However, I was able to add vertex to the graph with proper response. It seems like anything that has something to do with pipeline would not work properly. (ie no script is passed into the gremlin object in pipeline)