Shane
Shane

Reputation: 1216

Upsert a vertex with no data using mergeV in AWS neptune with javascript client

I have a very simple traversal with mergeV that is not working. Can anyone see where I am going wrong? I am using Neptune v1.3.2.1 with the npm gremlin client v3.7.3

I can addV fine, I can mergeV without errors, but nothing is actually persisted

const { t: { id } } = gremlin.process;

async function createRecords(connection) {
    const time = new Date().getTime()
    
    // generate 2 unique ids
    const anId1 = time.toString()
    const anId2 = (time + 1).toString()
    
    const g = traversal().withRemote(connection)

    // Insert record
    await g
      .addV()
      .property(id, anId1)
      .toList()
        
    // Query inserted record
    await g
      .V()
      .has(id, anId1)
      .toList()
      .then(x => console.log("add1", x))

    // LOGS: [{ Vertex { id: '...' }]

    // Upsert a record
    await g
      // upsert a record
      .mergeV(new Map([[id, anId2]]))
      .toList()
      // no error is thrown
        
    // Query upserted record
    await g
      .V()
      .has(id, anId2)
      .toList()
      .then(x => console.log("add2", x))

    // LOGS: []
}

Upvotes: 0

Views: 16

Answers (0)

Related Questions