-
Notifications
You must be signed in to change notification settings - Fork 46
Add New-CosmosDbTransactionalBatch command to support transactional batch operations
#517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds support for transactional batch operations in Cosmos DB by introducing the New-CosmosDbTransactionalBatch command. This allows multiple operations (Create, Upsert, Read, Replace, Delete) to be executed atomically or non-atomically against documents within the same partition key.
Key Changes:
- New public function
New-CosmosDbTransactionalBatchfor executing batch operations - New private helper function for setting custom type names on batch operation results
- Comprehensive unit and integration test coverage using Pester v5 syntax (first Pester v5 tests in the codebase)
- Custom format file for displaying transactional batch operation results
- Complete documentation in markdown format
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| source/Public/transactionalbatch/New-CosmosDbTransactionalBatch.ps1 | New public function implementing transactional batch operations with support for various operation types and atomic/non-atomic modes |
| source/Private/transactionalbatch/Set-CosmosDbTransactionalBatchOperationType.ps1 | Helper function to set custom type names on batch operation result objects |
| tests/Unit/CosmosDB.transactionalbatch.Tests.ps1 | Comprehensive unit tests covering all function scenarios including error handling |
| tests/Integration/CosmosDB.integration.Tests.ps1 | Integration tests verifying batch operations against actual Cosmos DB service |
| source/formats/transactionalbatch.formats.ps1xml | Custom format definitions for displaying batch operation results in table, wide, and list views |
| source/en-US/CosmosDB.strings.psd1 | Localization string for ShouldProcess message |
| source/CosmosDB.psd1 | Module manifest updates to export new function and include format file |
| docs/New-CosmosDbTransactionalBatch.md | Complete documentation with examples and parameter descriptions |
| CHANGELOG.md | Change log entry documenting the new feature |
source/Private/transactionalbatch/Set-CosmosDbTransactionalBatchOperationType.ps1
Show resolved
Hide resolved
source/Public/transactionalbatch/New-CosmosDbTransactionalBatch.ps1
Outdated
Show resolved
Hide resolved
source/Public/transactionalbatch/New-CosmosDbTransactionalBatch.ps1
Outdated
Show resolved
Hide resolved
…h.ps1 Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function New-CosmosDbTransactionalBatch | ||
| { | ||
| [CmdletBinding(SupportsShouldProcess = $true)] | ||
| [OutputType([System.Object[]])] | ||
| param ( |
Copilot
AI
Nov 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing comment-based help. Public functions should include comment-based help with at least .SYNOPSIS, .DESCRIPTION, .PARAMETER, .EXAMPLE, .OUTPUTS, and .NOTES sections as per PowerShell guidelines (CodingGuidelineID: 1000003). The private helper function Set-CosmosDbTransactionalBatchOperationType correctly includes comment-based help, but this public-facing cmdlet does not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not necessary since this command is in the docs folder
source/Public/transactionalbatch/New-CosmosDbTransactionalBatch.ps1
Outdated
Show resolved
Hide resolved
source/Public/transactionalbatch/New-CosmosDbTransactionalBatch.ps1
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
…rties (wide, list, table)
Pull Request
Description
Added
New-CosmosDbTransactionalBatchfunction for executing atomic transactional batch operations against a collection.Supports Create, Upsert, Read, Replace, and Delete operations on multiple documents within the same partition key
Related Issues
Fixes #516
Improvements / Enhancements
Testing
Contributor Mention
cc @PlagueHO
This change is