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"