v2kiran / PSLiteDB

PowerShell wrapper for LiteDB
MIT License
52 stars 6 forks source link

Update-LiteDBDocument is failing #7

Closed cadayton closed 4 years ago

cadayton commented 4 years ago

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.
v2kiran commented 4 years ago

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
cadayton commented 4 years ago

Thanks!! The workaround work for me.