using mergeV/E

Hello I’m trying to upgrade my gremlin package to latest and running into an issue with mergeE and mergeV. I’m using this to replace some coalace steps that I was using before. How do you set the label in mergeV() for the particular vertex. I see I can pass the T.label in the map but, I don’t understand what the equivalent of this would be for JavaScript
Solution
Another approach would be to inject a list of maps and do something like this:

var newNodes = []
newNodes.push(new Map([[(t.id),1],
            [(t.label),'Person'],
            ['name','Tom'],
            ['address','101 Elm Street']]));
newNodes.push(new Map([[(t.id),2],
            [(t.label),'Person'],
            ['name','Sally'],
            ['address','55 Main Street']]));
newNodes.push(new Map([[(t.id),3],
            [(t.label),'Person'],
            ['name','Jane'],
            ['address','222 5th Avenue']]));

g.inject(newNodes).unfold().mergeV(limit(local,1)).  //match on ID only
    next().
    then(data => {
        console.log(data);
    }).catch(error => {
        console.log('ERROR', error);
    });
Was this page helpful?