Victor G.
Victor G.

Reputation: 425

Gremlin bindings methods support

In gremlin docs they describe the use of bindings to reduce the overhead of compilation.

g.V(('id',1)).out('created').name.toList()

I tried to do the same on has method, but it didn't work

g.V().has('some_attribute', 'x', 'some_value')

Which methods can be improved using bindings? Can bindings be used on other methods as well besides V()?

Upvotes: 1

Views: 379

Answers (1)

stephen mallette
stephen mallette

Reputation: 46206

Bindings will work on any script you pass to Gremlin Server. In your examples though I don't see where those scripts would make use of bindings at all. Your first example doesn't appear to look valid. It should be something like:

g.V(x).out('created').values('name')

where "x" is a binding passed on the request with a value of "1".

Your second example should be something like:

g.V().has('name', x)

where "x" is a binding passed on the request with the value to match for the 'name' property. I'm just making that last one up as I didn't understand the original traversal too well and what you wanted parameterized.

Upvotes: 3

Related Questions