CosmosDB Graph : “upsert” query pattern

There are a number of ways to do this but I think that the TinkerPop community has generally settled on this approach: g.V().has(‘event’,’id’,’1′). fold(). coalesce(unfold(), addV(‘event’).property(‘id’,’1′)) Basically, it looks for the “event” with has() and uses fold() step to coerce to a list. The list will either be empty or have a Vertex in it. … Read more