© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Apache TinkerPopAT
Apache TinkerPop•4y ago•
6 replies
edolivares

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);
    });
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);
    });
Jump to solution
Apache TinkerPop banner
Apache TinkerPopJoin
Apache TinkerPop is an open source graph computing framework and the home of the Gremlin graph query language.
1,376Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

How to improve Performance using MergeV and MergeE?
Apache TinkerPopATApache TinkerPop / questions
17mo ago
Gremlin python MergeV update properties
Apache TinkerPopATApache TinkerPop / questions
13mo ago
.mergeV() with Javascript not working
Apache TinkerPopATApache TinkerPop / questions
2y ago
MergeV uint32 properties inserted as long
Apache TinkerPopATApache TinkerPop / questions
3y ago