Skip to content
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

Incorrect Handling of PartitionKey in Get-CosomosDBDocument with -Query parameter. #97

Closed
jasonchester opened this issue May 8, 2018 · 2 comments
Assignees
Labels
bug The issue is a bug. in progress The issue is being actively worked on by someone.

Comments

@jasonchester
Copy link
Contributor

jasonchester commented May 8, 2018

PartitionKey is handled when -Id is passed

@ https://github.com/PlagueHO/CosmosDB/blob/dev/src/lib/documents.ps1#L156-L159

    if (-not [String]::IsNullOrEmpty($Id))
    {
        # A document Id has been specified
        if ($PSBoundParameters.ContainsKey('PartitionKey'))

But is not handled in the else block. @ https://github.com/PlagueHO/CosmosDB/blob/dev/src/lib/documents.ps1#L173-L259

Error Produced:

PS /Users/jason.chester/_dev/LDM/scripts/generic> Measure-CosmosDbPartitionDocuments -PartitionKey "bmi"
Invoke-CosmosDbRequest : A parameter cannot be found that matches parameter name 'PartitionKey'.
At /usr/local/share/powershell/Modules/CosmosDB/2.0.10.388/lib/documents.ps1:242 char:42
+         $result = Invoke-CosmosDbRequest @PSBoundParameters `
+                                          ~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Invoke-CosmosDbRequest], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Invoke-CosmosDbRequest

Attatched file contains edits to documents.ps1 which resolved my specific issue.
documents.ps1.txt

  • Version of PowerShell you're using
Name                           Value
PSVersion                      6.0.0
PSEdition                      Core
GitCommitId                    v6.0.0
OS                             Darwin 17.6.0 Darwin Kernel Version 17.6.0: Fri Apr 13 19:57:44 PDT 2018; root:xnu-4570.60.17.0.1~3/RELEASE_X86_64
Platform                       Unix
  • PowerShell host you're using (eg. Console Host, ISE, Visual Studio)
    pwsh in terminal & VS Code Host

  • Operating system you're running
    macOS High Sierra
    version 10.13.5 Beta (17F45c)

  • Version of CosmosDB you're using (use Get-Module -Name CosmosDB)
    CosmosDB 2.0.10.388

@PlagueHO PlagueHO self-assigned this May 9, 2018
@PlagueHO PlagueHO added bug The issue is a bug. in progress The issue is being actively worked on by someone. labels May 9, 2018
@PlagueHO
Copy link
Owner

PlagueHO commented May 9, 2018

Thank you for raising this @jasonchester - I'll get this sorted this week and update the integration tests to cover this scenario.

@PlagueHO
Copy link
Owner

Hi @jasonchester,

The new version has been released to the PowerShell Gallery as 2.0.11.

Please reopen this if the problem still persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. in progress The issue is being actively worked on by someone.
Projects
None yet
Development

No branches or pull requests

2 participants