<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:02 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-178] Guid Serialization Bug?</title>
                <link>https://jira.mongodb.org/browse/CSHARP-178</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Maybe I&apos;m doing something wrong here, but the Guid serialization in the C# driver seems very odd.&lt;/p&gt;

&lt;p&gt;I save a Guid with a normal windows represenation of &quot;53E32701-9863-DE11-BD66-0015178A5E3C&quot;.&lt;/p&gt;

&lt;p&gt;I get that Guid back out of mongo from the shell as:&lt;/p&gt;

&lt;p&gt;ASfjU2OYEd69ZgAVF4pePA==&lt;/p&gt;

&lt;p&gt;If I call hex():&lt;/p&gt;

&lt;p&gt;127e353639811debd66015178a5e3c&lt;/p&gt;

&lt;p&gt;If I use a little function I wrote in Powershell as follows:&lt;/p&gt;

&lt;p&gt;function base64toguid&lt;br/&gt;
{&lt;br/&gt;
    param($str);&lt;br/&gt;
    $b = &lt;span class=&quot;error&quot;&gt;&amp;#91;System.Convert&amp;#93;&lt;/span&gt;::FromBase64String($str);&lt;br/&gt;
    $hex = &quot;&quot;;&lt;br/&gt;
    $idx = 0;&lt;br/&gt;
    foreach ($x in $b) &lt;/p&gt;
{
        $hex += $x.ToString(&quot;x2&quot;);
    }
&lt;p&gt;    $g = new-object -TypeName System.Guid -ArgumentList $hex;&lt;br/&gt;
    return $g;&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;I get: 0127e353-6398-11de-bd66-0015178a5e3c, which is the same as hex() from the shell.&lt;/p&gt;

&lt;p&gt;So to compare them closely:&lt;/p&gt;

&lt;p&gt;53E32701-9863-DE11-BD66-0015178A5E3C&lt;br/&gt;
0127e353-6398-11de-bd66-0015178a5e3c&lt;/p&gt;

&lt;p&gt;The first three sets look like they are reversed as if it&apos;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.&lt;/p&gt;</description>
                <environment>Windows 7, mongod 1.6.5</environment>
        <key id="14967">CSHARP-178</key>
            <summary>Guid Serialization Bug?</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="ericzbeard">Eric Z. Beard</reporter>
                        <labels>
                    </labels>
                <created>Wed, 2 Mar 2011 18:26:10 +0000</created>
                <updated>Thu, 20 Mar 2014 14:30:58 +0000</updated>
                            <resolved>Wed, 2 Mar 2011 20:43:52 +0000</resolved>
                                                    <fixVersion>0.11</fixVersion>
                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="25092" author="rstam" created="Wed, 2 Mar 2011 20:43:52 +0000"  >&lt;p&gt;Even though you&apos;ve found the explanation for what you were seeing, it still raises an interesting cross platform issue. Reading the Wikipedia article on GUIDs it seems like the string representation is the &quot;official&quot; representation and that the binary representation of that string will vary depending on whether the platform you are on is little endian or big endian.&lt;/p&gt;

&lt;p&gt;That poses a problem when exchanging GUIDs between systems in binary form, because the binary form doesn&apos;t specify whether it came from a little endian or a big endian system.&lt;/p&gt;

&lt;p&gt;So I suppose in the MongoDB world (or the BSON spec) we just have to declare arbitrarily that we will use the binary representation as it would be produced on a little endian system (in other words, like Windows running on Intel hardware). That way we can unambiguously interpret the 16 byte binary array we are storing in and retrieving from MongoDB.&lt;/p&gt;</comment>
                            <comment id="25090" author="ericzbeard" created="Wed, 2 Mar 2011 19:48:17 +0000"  >&lt;p&gt;Ok, I figured it out with help from stackoverflow, it&apos;s my misconception rather than a bug.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://stackoverflow.com/questions/5172134/base64-to-guid-to-base64/5172351&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://stackoverflow.com/questions/5172134/base64-to-guid-to-base64/5172351&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It would be cool if there was something like toGuid() in the shell for those of us on windows who need to quickly convert to the regular Guid represenation.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrh98v:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14297</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>