Closed sdacalor closed 3 years ago
Hello Kiran,
I found that ConvertTo-LiteDbBSON function at line 39 may be the source : ... | Where-Object definition -match "int64|long" | Select-Object -ExpandProperty Name ...
Any idea Regards
hello Steeve Indeed that is the source of the error. Good job in figuring that out. When I created this project it was for my personal use so I used some very relaxed regex filters which as the adoption has grown has shown to be inadequate. Basically we need to match the string long at the beginning of the definition instead of anywhere in the whole string.
This can be fixed by changing the regex as below:
"int64|long"
TO
"^system\.int64|^long"
I will release a new version shortly with fixes for #10 & #11
PS: You probably figured it out already but to clarify this project PSlitedb is managed by me alone whereas litedb (the original dot net library) is managed by a group of people.
Hi Kiran,
Great. We can close the case. Thanks
Hi Team,
I am using PSLite 2.1.0. Updated litedb to the latest available version 5.0.9 Trying to import string value which contains the world "Long" failed.
Collection name is PublicTeamsTeamCln
$teamRecord = @{GroupId=324186ae-00a0-41be-a50d-9292830900a1; GroupDisplayName= "MyGroup"; Alias=""; GroupOwner="Kai-Long Mister"; GroupOwnerUPN="kai-long.mister@company.com"; Members=6; CreatedDateTime=09/18/2019 13:16:51}
$o = $teamRecord | Select-Object @{ Name = "_id"; E = { [System.String]$teamRecord.GroupId} }, @{ Name = "GroupDisplayName"; E = { [System.String]$teamRecord.GroupDisplayName } }, @{ Name = "Alias"; E = { [System.String]$teamRecord.Alias } }, @{ Name = "GroupOwner"; E = { [System.String]$teamRecord.GroupOwner } }, @{ Name = "GroupOwnerUPN"; E = { [System.String]$teamRecord.GroupOwnerUPN } }, @{ Name = "Members"; E = { [int]$teamRecord.Members } }, @{ Name = "CreatedDateTime"; E = { [datetime]$teamRecord.CreatedDateTime } }
$o | ConvertTo-LiteDbBSON | Upsert-LiteDBDocument -Collection PublicTeamsTeamCln
The error Failed to find document in Db: Impossible to convert value « Kai-Long Mister » in type « System.Int64 ». Erreur : « incorrect input string format »
Please, give a help, Regards