0

In azure , when I have creating Resource Group, putting the resource group name (RG1,RG2,etc.,) in my cosmos db in an array as follows,

"id": "resourceGroup",
    "rgValues": {
        "name": [
            "RG1",
            "RG2"]}

If I want to delete RG1 or RG2 alone from document while rollback the resource group in case of the elements failure.

sathya
  • 1,708
  • 1
  • 15
  • 32

1 Answers1

0

If I understood your question correctly, you want a mechanism to rollback your transaction in case of failure.

It's pretty much possible in cosmosdb. You have to write a stored procedure; it's a server side JS coding.

Transactions are deeply and natively integrated into Cosmos DB’s JavaScript programming model. Inside a JavaScript function, all operations are automatically wrapped under a single transaction. If the JavaScript completes without any exception, the operations to the database are committed. In effect, the “BEGIN TRANSACTION” and “COMMIT TRANSACTION” statements in relational databases are implicit in Cosmos DB. If there is any exception that’s propagated from the script, Cosmos DB’s JavaScript runtime will roll back the whole transaction

please follow the link for more info.

lambodar
  • 2,962
  • 4
  • 30
  • 53