From 5cd546ddf06e61a3c8b3520cd621d26353942e57 Mon Sep 17 00:00:00 2001 From: Jiri Formacek Date: Mon, 6 Nov 2023 12:15:45 +0100 Subject: [PATCH] bugfix --- Commands/Public/New-CosmosDocuument.ps1 | 2 ++ Commands/Public/Set-CosmosDocument.ps1 | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Commands/Public/New-CosmosDocuument.ps1 b/Commands/Public/New-CosmosDocuument.ps1 index 0eeee32..4fe9f82 100644 --- a/Commands/Public/New-CosmosDocuument.ps1 +++ b/Commands/Public/New-CosmosDocuument.ps1 @@ -91,6 +91,8 @@ function New-CosmosDocument if($PSCmdlet.ParameterSetName -eq 'DocumentObject') { $Document = $DocumentObject | ConvertTo-Json -Depth 99 -Compress + #when in pipeline in PS5.1, parameter retains value across invocations + $PartitionKey = @() foreach($attribute in $PartitionKeyAttribute) { $PartitionKey+=$DocumentObject."$attribute" diff --git a/Commands/Public/Set-CosmosDocument.ps1 b/Commands/Public/Set-CosmosDocument.ps1 index d3bc999..261b737 100644 --- a/Commands/Public/Set-CosmosDocument.ps1 +++ b/Commands/Public/Set-CosmosDocument.ps1 @@ -88,6 +88,9 @@ function Set-CosmosDocument { #to change document Id, you cannot use DocumentObject parameter set $Id = $DocumentObject.id + #when in pipeline in PS5.1, parameter retains value across invocations + $PartitionKey = @() + foreach($attribute in $PartitionKeyAttribute) { $PartitionKey+=$DocumentObject."$attribute"