Add or get vertex in Azure Cosmos DB Graph API

后端 未结 2 574
闹比i
闹比i 2021-01-25 09:58

Using Gremlin, I can create a vertex in an Azure Cosmos DB graph by issuing

g.addV(\'the-label\').property(\'id\', \'the-id\')

and subsequently

2条回答
  •  粉色の甜心
    2021-01-25 10:21

    Please look at this.

    http://tinkerpop.apache.org/docs/current/reference/#coalesce-step

    You can try

    g.Inject(0).coalesce(__.V().has('id', 'the-id'), addV('the-label').property('id', 'the-id'))

    btw, you won't able to find the vertex using g.V('the-label').has('id', 'the-id').

    g.V() accepts vertex id as parameters and not vertex labels.

提交回复
热议问题