azure-cosmosdb
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
cosmos db sql query with non alphanumeric field name
To use a special character, like $, you need to use bracket notation: SELECT c._id FROM c order by c._id[“$oid”] You can do this with each property in the hierarchy, so the following also works: SELECT c._id FROM c order by c[“_id”][“$oid”]