Skip to content

[P1] Add Transactional Batch support #105

@sajeetharan

Description

@sajeetharan

Feature Request

Priority: P1 (High)

Description

Cosmos DB supports transactional batch operations (multiple operations within the same partition key that either all succeed or all fail), but CosmosDB Shell does not expose this capability.

Comparable Features in Other Shells

  • mongosh: Session.startTransaction() / commitTransaction()

Proposed Behavior

Add transactional batch support:

  • batch begin — Start a batch context for a specific partition key
  • batch add <operation> — Add create/replace/upsert/patch/delete operations
  • batch execute — Execute all operations atomically
  • batch cancel — Discard pending operations
  • Show per-operation results and total RU cost

Example Usage

cd /MyDatabase/MyContainer
batch begin --partition-key "pk1"
batch add create '{"id": "1", "pk": "pk1", "name": "Item 1"}'
batch add create '{"id": "2", "pk": "pk1", "name": "Item 2"}'
batch add delete "3"
batch execute

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions