<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:35:59 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-1240] Sort with unordered map type</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-1240</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;The SetSort() option currently accepts an interface{} value.&lt;/p&gt;

&lt;p&gt;But it is incorrect to use an unordered map here, because it could have unexpected behavior.&lt;/p&gt;

&lt;p&gt;I would expect it to return an error (or panic).&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;The same problem exists for index keys.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;The error message should recommend to use bson.A.&lt;/p&gt;</description>
                <environment></environment>
        <key id="901046">GODRIVER-1240</key>
            <summary>Sort with unordered map type</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="divjot.arora@mongodb.com">Divjot Arora</assignee>
                                    <reporter username="pierrre">Pierre Durand</reporter>
                        <labels>
                    </labels>
                <created>Tue, 20 Aug 2019 13:53:00 +0000</created>
                <updated>Thu, 29 Aug 2019 21:59:21 +0000</updated>
                            <resolved>Thu, 22 Aug 2019 20:28:33 +0000</resolved>
                                    <version>1.1.0</version>
                                                    <component>CRUD</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="2400603" author="divjot.arora" created="Thu, 29 Aug 2019 21:59:21 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=pierrre&quot; class=&quot;user-hover&quot; rel=&quot;pierrre&quot;&gt;pierrre&lt;/a&gt;&#160;Because we have a codec-based customizable BSON layer, a user could write a codec for &lt;tt&gt;bson.M&lt;/tt&gt;. This would essentially be the same as defining a &lt;tt&gt;MarshalBSON&lt;/tt&gt; for the type and would allow a user to specify an ordering. Because of this, it isn&apos;t really possible for us to know if users are using a plain &lt;tt&gt;bson.M&lt;/tt&gt; or something more customized.&lt;/p&gt;</comment>
                            <comment id="2383403" author="pierrre" created="Thu, 22 Aug 2019 21:05:25 +0000"  >&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;implements&#160;MarshalBSON&#160;and therefore can enforce an ordering&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;Right, I didn&apos;t think about this.&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Generally, we recommend using ordered types like&#160;bson.D&#160;and using the MongoDB documentation to find out which fields must be ordered.&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;But I&apos;ve seen developers using bson.M instead of ordered data structure. I caught this error during a code review. So it&apos;s happening for real. It&apos;s not an hypothetical issue.&lt;/p&gt;

&lt;p&gt;A proposal; maybe we could detect the issue for some specific types that we know will be invalid: bson.M and map&lt;span class=&quot;error&quot;&gt;&amp;#91;string&amp;#93;&lt;/span&gt;interface{}. We could do a type assertion without any reflection.&lt;/p&gt;

&lt;p&gt;What do you think ?&lt;/p&gt;</comment>
                            <comment id="2383320" author="divjot.arora" created="Thu, 22 Aug 2019 20:28:33 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=pierrre&quot; class=&quot;user-hover&quot; rel=&quot;pierrre&quot;&gt;pierrre&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Most of the options that take interface{} convert the given option into a document, which usually needs to be ordered. It would be difficult for us to error if someone gives a map for one of these options because a user could create a new type that is a map but implements &lt;tt&gt;MarshalBSON&lt;/tt&gt; and therefore can enforce an ordering. It would be too strict for us to error in these situations. Generally, we recommend using ordered types like &lt;tt&gt;bson.D&lt;/tt&gt; and using the MongoDB documentation to find out which fields must be ordered.&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|hvao13:</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>