<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:35:04 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>[GODRIVER-830] Add support for mongodb UUID type</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-830</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;Current implementation does not support the mongodb native UUID type, which allows to store and read the golang UUID (&lt;span class=&quot;error&quot;&gt;&amp;#91;16&amp;#93;&lt;/span&gt;byte), as mongodb binary (subtype 4).&lt;/p&gt;</description>
                <environment></environment>
        <key id="697264">GODRIVER-830</key>
            <summary>Add support for mongodb UUID type</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="stevenceuppens">Steven Ceuppens</reporter>
                        <labels>
                    </labels>
                <created>Thu, 14 Feb 2019 12:20:39 +0000</created>
                <updated>Wed, 6 Jul 2022 19:05:11 +0000</updated>
                            <resolved>Fri, 22 Feb 2019 18:36:13 +0000</resolved>
                                                                    <component>BSON</component>
                                        <votes>1</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="3987156" author="JIRAUSER1261277" created="Sat, 7 Aug 2021 19:00:14 +0000"  >&lt;p&gt;Is it still the case? Currently there is an UUID helper class inside the driver:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/tree/master/x/mongo/driver/uuid&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/tree/master/x/mongo/driver/uuid&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, using this generates BSON document with a generic binary subtype (0x00) instead of UUID (0x04) that in return fails to be decoded on subsequent queries.&lt;/p&gt;

&lt;p&gt;As the UUID type is part of the official BSON specification, it should be appropriate to handle the UUID encoding and decoding at the driver level. Even the driver itself has appropriate subtype values defined:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/83fefd1b968009442a78a1be273f719f9a14b10e/bson/bsontype/bsontype.go#L39&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/blob/83fefd1b968009442a78a1be273f719f9a14b10e/bson/bsontype/bsontype.go#L39&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the MongoDB documentation itself says that UUID is one of the common options to be used as a primary key, it should be supported natively by the driver:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/core/document/#the-_id-field&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/core/document/#the-_id-field&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2167484" author="slooker" created="Fri, 1 Mar 2019 15:44:21 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kris.brandow&quot; class=&quot;user-hover&quot; rel=&quot;kris.brandow&quot;&gt;kris.brandow&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Sorry for all the questions, but if i&apos;m querying like this:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;var result SomeStruct&lt;/tt&gt;{}&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;err = client.Database(databaseName).Collection(collection).FindOne(ctx, bson.M{&quot;_id&quot;: assetID}).Decode(&amp;amp;result)&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;How can I test the result.&#160; Is there a different way to query that I&apos;m not using that I can check the _id afterwards to figure out whether I need to decode it or not?&#160; If you can point me to some documentation that explains any of this, I&apos;d love to read that and not bug you so much.&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2160588" author="kris.brandow" created="Fri, 22 Feb 2019 23:38:04 +0000"  >&lt;p&gt;You should be able to take the bytes from &lt;tt&gt;primitive.Binary.Data&lt;/tt&gt; and turn them into a UUID type of your choice.&lt;/p&gt;</comment>
                            <comment id="2160171" author="slooker" created="Fri, 22 Feb 2019 19:22:52 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kris.brandow&quot; class=&quot;user-hover&quot; rel=&quot;kris.brandow&quot;&gt;kris.brandow&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Good to know.&#160; I guess I&apos;m unclear how to decode it from a BSON Binary type.&#160; I looked in the docs and was unable to find a good example.&#160; In our setup, all &lt;tt&gt;_id&lt;/tt&gt;&apos;s are going to be UUIDs.&#160; I just don&apos;t know how to decode them from BSON binary.&lt;/p&gt;

&lt;p&gt;Shawn&lt;/p&gt;</comment>
                            <comment id="2160160" author="kris.brandow" created="Fri, 22 Feb 2019 19:19:00 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=slooker&quot; class=&quot;user-hover&quot; rel=&quot;slooker&quot;&gt;slooker&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;You should be able to check the type of the &lt;tt&gt;_id&lt;/tt&gt; field, if it&apos;s 0x05 then it&apos;s a BSON Binary type (so UUID) and if it&apos;s 0x07 it&apos;s a BSON ObjectID.&lt;/p&gt;

&lt;p&gt;--Kris&lt;/p&gt;</comment>
                            <comment id="2160137" author="slooker" created="Fri, 22 Feb 2019 19:02:37 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kris.brandow&quot; class=&quot;user-hover&quot; rel=&quot;kris.brandow&quot;&gt;kris.brandow&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;With the current implementation, how can we query if _id is set to be a UUID instead of an ObjectID?&lt;/p&gt;

&lt;p&gt;Thanks,&lt;/p&gt;

&lt;p&gt;Shawn&lt;/p&gt;</comment>
                            <comment id="2155728" author="kris.brandow" created="Tue, 19 Feb 2019 16:40:46 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=stevenceuppens&quot; class=&quot;user-hover&quot; rel=&quot;stevenceuppens&quot;&gt;stevenceuppens&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;In MongoDB drivers we don&apos;t attempt to interpret the bytes in a BSON Binary value. If you want this functionality, registering a codec or creating a UUID type with the proper Marshal* and Unmarshal* methods, should do the trick.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;/p&gt;

&lt;p&gt;Kris&lt;/p&gt;</comment>
                            <comment id="2155492" author="slooker" created="Tue, 19 Feb 2019 14:47:50 +0000"  >&lt;p&gt;About how long does it normally take a ticket to be approved and merged in, assuming there&apos;s no issues?&lt;/p&gt;</comment>
                            <comment id="2153164" author="stevenceuppens" created="Fri, 15 Feb 2019 14:17:18 +0000"  >&lt;p&gt;PR created&#160;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/444886&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/444886&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2084083">GODRIVER-2484</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <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|hudb4n:</customfieldvalue>

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