Reputation: 5550
I'm trying to perform some math on the properties of a Vertex. My solution works in the Gremlin console, but throws an error when run in JavaScript.
gremlin> g.addV("trip").property(single, "trackLength", 100).property(single, "travelDistance", 75).property(single, "carWeight", 10)
==>v[f8b42b9d-9053-2838-808d-ba14606b8390]
gremlin> g.V("f8b42b9d-9053-2838-808d-ba14606b8390").property(single, "carFactor", __.project("trackLength", "travelDistance", "carWeight").by("trackLength").by("travelDistance").by("carWeight").math("(trackLength - travelDistance) * carWeight")).valueMap()
I get the expected result when running in the console:
==>{trackLength=[100], travelDistance=[75], carWeight=[10], carFactor=[250.0]}
However when I run this in JS I get an error:
TypeError: __.project(...).by(...).by(...).by(...).math is not a function
Gremlin version 3.2.10
. I've tried upgrading to ^3.4.0
but am encountering a separate issue addressed here.
Upvotes: 0
Views: 250
Reputation: 46226
The math()
step was only introduced on 3.3.1, so if you're using 3.2.10, that's not going to work. Perhaps try 3.3.5 and see if math()
works there.
Upvotes: 1