Cosmos DB – Deleting a document

The DocumentDB API’s SQL is specifically for querying. That is, it only provides SELECT, not UPDATE or DELETE. Those operations are fully supported, but require REST (or SDK) calls. For example, with .net, you’d call DeleteDocumentAsync() or ReplaceDocumentAsync(), and in node.js, this would be a call to deleteDocument() or replaceDocument(). In your particular scenario, you … Read more

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