[SOLVED] drop specific Vertices that may not exist


I would like to drop specific vertices from my Neptune graph. I get a list of id’s from outside Neptune and wish to drop all of them. Problem is, some of them may not exist.

I tried this, but it seems I can’t hand over an array:

g.V(['1', '12', '14']).drop().iterate()

I also tried stringing single drop operations together with store, aggregate or sideEffect, but as soon as one of the vertices doesn’t exists, the call doesn’t delete anything…

g.addV('test').property(id, '1')
  .addV('test').property(id, '12')


(I can iterate over the list and string a query together, but of course this never works with

I’m using typescript around the gremlin code.
Neptune runs with gremlin: {‘version’: ‘tinkerpop-3.4.11’}


Your first approach is the correct way to write your traversal – passing a List of id should work:

g.V(['1', '12', '14']).drop().iterate()

you could alternatively do any of the following (and other variations):

g.V('1', '12', '14').drop().iterate()
g.V().hasId('1', '12', '14').drop().iterate()
g.V().hasId(within['1', '12', '14']).drop().iterate()

They should all equate to the first one though.

Answered By – stephen mallette

Answer Checked By – Timothy Miller (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *