-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Environment:Windows 7, mongod 1.6.5
Maybe I'm doing something wrong here, but the Guid serialization in the C# driver seems very odd.
I save a Guid with a normal windows represenation of "53E32701-9863-DE11-BD66-0015178A5E3C".
I get that Guid back out of mongo from the shell as:
ASfjU2OYEd69ZgAVF4pePA==
If I call hex():
127e353639811debd66015178a5e3c
If I use a little function I wrote in Powershell as follows:
function base64toguid
{
param($str);
$b = [System.Convert]::FromBase64String($str);
$hex = "";
$idx = 0;
foreach ($x in $b)
$g = new-object -TypeName System.Guid -ArgumentList $hex;
return $g;
}
I get: 0127e353-6398-11de-bd66-0015178a5e3c, which is the same as hex() from the shell.
So to compare them closely:
53E32701-9863-DE11-BD66-0015178A5E3C
0127e353-6398-11de-bd66-0015178a5e3c
The first three sets look like they are reversed as if it's some sort of endian issue, but the last two are not reversed. Since the dashes are totally arbitrary, if it was an endian issue it seems like the whole thing would be reversed.