v2kiran / PSLiteDB

PowerShell wrapper for LiteDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update-LiteDBDocument is failing

cadayton opened this issue · comments

Using the example presented in the README and other testing code (https://cadayton.keybase.pub/PSGallery/Scripts/psConsole.html), the Update-LiteDBDocument command is consistently failing with the same error message.

PS>Get-Service BITS |
>>   Select @{Name="_id";E={$_.Name}},DisplayName,Status,StartType |
>>         ConvertTo-LiteDbBSON |
>>         Update-LiteDBDocument -Collection SvcCollection
Update-LiteDBDocument:
Line |
   4 |          Update-LiteDBDocument -Collection SvcCollection
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.

you are right, it does fail. Will check.
for now please use the workaround:

  $docs = Get-Service BITS |
    select @{Name = "_id"; E = { $_.Name } }, DisplayName, Status, StartType |
    ConvertTo-LiteDbBSON 

    $docs  | Update-LiteDBDocument -Collection test

Thanks!! The workaround work for me.