Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.
I received a comment to my Optimistic Concurrency in Azure Cosmos DB a couple weeks ago from Jerry Goyal:Can we somehow handle the concurrency among multiple documents (transactions)?Since ETags are defined on each document, you must build your concurrency around them. However, this made me start to wonder how to update multiple documents at the same time using their respective ETags. Meaning you would want both documents to update together only if both of their ETags were current. If one was valid and the other was out of date, none of the documents would update.
Transactions
It’s pretty obvious that I’m looking for transactions within Azure Cosmos DB.Azure Cosmos DB supports language-integrated transactions via JavaScript stored procedures and triggers. All database operations inside scripts are executed under snapshot isolation scoped to the collection if it is a single-partition collection, or documents with the same partition key value within a collection, if the collection is partitioned.There is no client transaction scope you can use with the .NET SDK. Meaning from the client (.NET) you cannot create a transaction scope. It has to be done on the Azure Cosmos DB server via stored procedure or trigger.
The thing I don’t like about documentdb is that it doesn’t support aggregations nor paging.
Pretty sure you can accomplish paging via sending the RequestContinuation in the FeedOptions using the .NET SDK. I’ll create a post around this to demo.
I’ve created a post on how to implement query continuations. I realize this isn’t full on paging, but worth mentioning the capabilities.
https://codeopinion.com/paging-documentdb-query-results-from-net/