<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:34:37 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-632] Add As* methods to bsoncore.Value, bson.RawValue, and bson.Val types</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-632</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;Numeric BSON value types can be difficult to deal with. Depending on the source, a number might be a float64, int32, int64, or decimal128. To ease the usability of the &lt;tt&gt;Value&lt;/tt&gt; types, add &lt;tt&gt;As*&lt;/tt&gt;&#160; and &lt;tt&gt;As*OK&lt;/tt&gt;&#160;methods to each value type for &lt;tt&gt;float64&lt;/tt&gt;, &lt;tt&gt;int32&lt;/tt&gt;, and &lt;tt&gt;int64.&lt;/tt&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="631537">GODRIVER-632</key>
            <summary>Add As* methods to bsoncore.Value, bson.RawValue, and bson.Val types</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="12300">Won&apos;t Do</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="kris.brandow@mongodb.com">Kristofer Brandow</reporter>
                        <labels>
                            <label>neweng</label>
                    </labels>
                <created>Fri, 9 Nov 2018 00:09:49 +0000</created>
                <updated>Tue, 7 Feb 2023 01:51:34 +0000</updated>
                            <resolved>Mon, 6 Feb 2023 21:15:39 +0000</resolved>
                                                                    <component>BSON</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="5172819" author="JIRAUSER1259527" created="Tue, 7 Feb 2023 01:51:34 +0000"  >&lt;p&gt;Adding more detail about why we decided to close this:&lt;/p&gt;

&lt;p&gt;Conversion between numeric types can be silently lossy in non-intuitive ways, so we should limit the ability to silently lose data in the &lt;tt&gt;As*&lt;/tt&gt; APIs. Specifically, the following BSON numeric type conversion cases are lossy:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Converting a BSON &quot;double&quot; (64-bit float) into a Go &lt;tt&gt;int32&lt;/tt&gt; will silently lose data for values:
	&lt;ul&gt;
		&lt;li&gt;Any value with a fractional part (truncates the fractional part)&lt;/li&gt;
		&lt;li&gt;Greater than &lt;tt&gt;math.MaxInt32&lt;/tt&gt; (returns &lt;tt&gt;math.MinInt32&lt;/tt&gt;)&lt;/li&gt;
		&lt;li&gt;Less than &lt;tt&gt;math.MinInt32&lt;/tt&gt; (returns &lt;tt&gt;math.MinInt32&lt;/tt&gt;)&lt;/li&gt;
		&lt;li&gt;NaN, +Inf, -Inf (returns &lt;tt&gt;math.MinInt32&lt;/tt&gt;)&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;Converting a BSON &quot;double&quot; (64-bit float) into a Go &lt;tt&gt;int64&lt;/tt&gt; will silently lose data for values:
	&lt;ul&gt;
		&lt;li&gt;Any value with a fractional part (truncates the fractional part)&lt;/li&gt;
		&lt;li&gt;Greater than &lt;tt&gt;math.MaxInt64&lt;/tt&gt; (returns &lt;tt&gt;math.MinInt64&lt;/tt&gt;)&lt;/li&gt;
		&lt;li&gt;Less than &lt;tt&gt;math.MinInt64&lt;/tt&gt; (returns &lt;tt&gt;math.MinInt64&lt;/tt&gt;)&lt;/li&gt;
		&lt;li&gt;NaN, +Inf, -Inf&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;Converting a BSON &quot;int64&quot; (64-bit integer) into a Go &lt;tt&gt;int32&lt;/tt&gt; will silently lose data for values:
	&lt;ul&gt;
		&lt;li&gt;Greater than &lt;tt&gt;math.MaxInt32&lt;/tt&gt; (overflow and flip sign)&lt;/li&gt;
		&lt;li&gt;Less than &lt;tt&gt;math.MinInt32&lt;/tt&gt; (overflow and flip sign)&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;Converting a BSON &quot;int64&quot; (64-bit integer) into a Go &lt;tt&gt;float64&lt;/tt&gt; will silently lose data for values:
	&lt;ul&gt;
		&lt;li&gt;Greater than &lt;tt&gt;2^53&lt;/tt&gt; (lose integer precision)&lt;/li&gt;
		&lt;li&gt;Less than &lt;tt&gt;-1 * 2^53&lt;/tt&gt; (lose integer precision)&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Converting BSON &quot;decimal128&quot; to native Go types is even less intuitive and should be avoided.&lt;/p&gt;

&lt;p&gt;Since we know the cases where we&apos;ll lose data, it&apos;s possible we can allow conversion when it isn&apos;t lossy (which is true for many every-day values). For reference, &lt;tt&gt;bson.Unmarshall&lt;/tt&gt; does allow converting between int &amp;lt;-&amp;gt; float when there is no truncation, but does not catch precision errors for too-large integer values.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="541629">GODRIVER-413</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="623508">GODRIVER-610</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1887367">GODRIVER-2167</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </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_14266" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Documentation Changes Summary</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;1.  What would you like to communicate to the user about this feature?&lt;br/&gt;
2.  Would you like the user to see examples of the syntax and/or executable code and its output?&lt;br/&gt;
3.  Which versions of the driver/connector does this apply to?&lt;/p&gt;</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr6k64:3zr</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>