jbmusso / gremlin-javascript

JavaScript tools for graph processing in Node.js and the browser inspired by the Apache TinkerPop API
MIT License
214 stars 63 forks source link

Id bound parameter not working #23

Closed ghost closed 8 years ago

ghost commented 8 years ago

// Doesn't work client.execute("g.V(id).valueMap()", {id:53408}, function(err, results) { console.log(results); next(); });

// Works client.execute("g.V(53408).valueMap()", function(err, results) { console.log(results); next(); });

ghost commented 8 years ago

Also, the returned err is null.

jbmusso commented 8 years ago

Thanks for spotting this. Which graph database (and version) are you using?

ghost commented 8 years ago

I'm using Titan 1.0. DockerFile repo here: https://github.com/realolliebee/db

jbmusso commented 8 years ago

Do you get any warnings/errors in the gremlin server terminal by chance? (I didn't have time to try your Dockerfile yet, sorry). Otherwise, I'm guessing an issue with the type of id where Titan expects a long and gremlin server interprets that id as an integer.

edit: typo

ghost commented 8 years ago

No errors in the gremlin server terminal. Do you know if there's some advanced error reporting I can enable?

jbmusso commented 8 years ago

You can try starting gremlin-server with the -v (verbose) flag.

ghost commented 8 years ago

The verbose flag didn't help, but I figured it out anyway. It only fails for 'id' and 'ID' (though not for 'Id' or 'iD'). I'm guessing 'id' is reserved, similar to 'label'. I'll close the issue, but you should probably update your bound parameters example (and maybe make a note about id): https://github.com/jbmusso/gremlin-javascript#adding-bound-parameters-to-your-scripts

Thanks for the help!

dmill-bz commented 8 years ago

There are a few new reserved keys in titan 1.0 . key is another one.

ghost commented 8 years ago

Thanks @PommeVerte, do you know if that's documented anywhere?

dmill-bz commented 8 years ago

Not that I could find. I also asked about a full list but haven't heard back yet. I would assume the following are reserved: