-1

I am trying to query cosmos db Graph and my query looks like as follows :

g.addV('CITY').property('id','cityId').as("vertex").addV('VERSION').property('name','city').property('id','jsjsj').as("versionVertex").addE('CURRENT_STATE').from("vertex").to("versionVertex").property('startTime','152567845776').property('endTime','922337203684775807').V('state').as("fromVertex").addE('CONTAINS').property('id','ssjjs').from("fromVertex").to("vertex")

My doubt is , if the above query is atomic or not. As i can see it should fail if any of the node exists. But it doesn't rather half of my query runs and other half does not.

Can anyone suggest me a way to make the queries atomic.

user2565192
  • 694
  • 1
  • 8
  • 19

1 Answers1

1

CosmosDB Gremlin queries are not atomic. The recommendation is to make the queries idempotent to ensure the write ops can be completed on retrying the request.

See the answers for this question which demonstrate the 'upsert pattern': Add or get vertex in Azure Cosmos DB Graph API

Oliver Towers
  • 445
  • 2
  • 7