I am using nodejs gremlin against AWS neptune, the requirement is to update properties if vertice exist, or else, create a new vertice, i tried below
g.V().has('event','id','1').
fold().
coalesce(unfold(),
addV('event').property('id','1'))
but I got 'unfold is not defined' error, how do I resolve this?
You probably just need to import unfold()
properly. Some common imports for working with Gremlin can be found here but in your case I think you just need to do:
const __ = gremlin.process.statics
and then refer to unfold()
as __.unfold()
- or just import unfold()
as a function explicitly to use it as you were using it.