all examples for mergeV/mergeE seem to be groovy but it's not obvious how to translate them to javascript. I got as far as this:
const { onCreate, onMatch } = gremlin.process.merge;
const { from_, to } = gremlin.process.direction;
this
.mergeE(to, tgt.id)
.option(onCreate, { created: now, updated: now })
.option(onMatch, { updated: now })
but the mergeE instruction generates an error.
I tried:
.mergeE([to, tgt.id])
with the effect: "Could not locate exact method given the supplied arguments: NeptuneGraphTraversal.mergeE(ArrayList)"
.mergeE(to, tgt.id)
Could not locate exact method given the supplied arguments
.mergeE({ [to.toString()]: tgt.id, [from_.toString()]: this.id })
an unexpected error has occured in Neptune; obviously we cannot do [to]: tgt.id in js
If anyone has a clear example for mergeE in javascript/typescript, it would help immensely. I'm asking specifically in the Amazon Neptune context but hopefully it can be useful for other cases as well. Even better would be to have a side-by side example for mergeV, but maybe a lot to ask.
Ideally the example will show how it's possible to merge from/to a node that was selected in a previous statement since this is a pattern especially when working in a dsl context.
Thank you
Note: this is an almost exact re:post of my question on stackoverflow. The only comment there so far is to try https://www.gremlator.com/, but it's probably helpful in other situations, not when looking for a full example. One thing i've learned from it though is that likely I should be using new Map(...) instead of a plain object where groovy maps are shown in the docs. Again, it would help to have this as a working example.