<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:37:03 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-509] Remove superfluous Create methods and change how remaining Create methods handle C# null</title>
                <link>https://jira.mongodb.org/browse/CSHARP-509</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;Original description&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;var value = BsonBoolean.Create(&quot;false&quot;);&lt;/p&gt;

&lt;p&gt;value.RawValue == true&lt;/p&gt;

&lt;p&gt;?!!!&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;Edited description&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The BsonDocument object model has many Create methods that are not strictly required. We are going to do some cleaning up and remove them. There are explicit conversions that do exactly the same thing.&lt;/p&gt;

&lt;p&gt;We are leaving the Create methods that take an object parameter, because in that case the user can&apos;t call a constructor, because the required BsonValue subclass isn&apos;t known at compile time.&lt;/p&gt;

&lt;p&gt;We are also changing how the remaining Create methods handle C# null. They will now throw an ArgumentNullException if the value is C# null, with the exception of BsonValue.Create which will map C# null to BsonNull.Value.&lt;/p&gt;

&lt;p&gt;We are also changing the Add methods to throw ArgumentNullException if callled with a C# null argument (they used to treat C# null as a no-op).&lt;/p&gt;</description>
                <environment></environment>
        <key id="42095">CSHARP-509</key>
            <summary>Remove superfluous Create methods and change how remaining Create methods handle C# null</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="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="gfx00">Brian</reporter>
                        <labels>
                    </labels>
                <created>Fri, 22 Jun 2012 08:30:30 +0000</created>
                <updated>Fri, 22 May 2015 12:59:10 +0000</updated>
                            <resolved>Mon, 21 Apr 2014 19:15:13 +0000</resolved>
                                    <version>1.8</version>
                                    <fixVersion>2.0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="557760" author="xgen-internal-githook" created="Mon, 21 Apr 2014 18:25:50 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-509&quot; title=&quot;Remove superfluous Create methods and change how remaining Create methods handle C# null&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-509&quot;&gt;&lt;del&gt;CSHARP-509&lt;/del&gt;&lt;/a&gt;: Check for null keys.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/43b9ab26fe9a0f85787ccc4d5c15607efcb54cbd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/43b9ab26fe9a0f85787ccc4d5c15607efcb54cbd&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="557759" author="xgen-internal-githook" created="Mon, 21 Apr 2014 18:25:48 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-509&quot; title=&quot;Remove superfluous Create methods and change how remaining Create methods handle C# null&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-509&quot;&gt;&lt;del&gt;CSHARP-509&lt;/del&gt;&lt;/a&gt;: Fixed unit tests for Add and AddRange with C# null.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/baa58b5eadd269619e27ea2c5c660ab3eb74e3d5&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/baa58b5eadd269619e27ea2c5c660ab3eb74e3d5&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="557758" author="xgen-internal-githook" created="Mon, 21 Apr 2014 18:25:45 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-509&quot; title=&quot;Remove superfluous Create methods and change how remaining Create methods handle C# null&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-509&quot;&gt;&lt;del&gt;CSHARP-509&lt;/del&gt;&lt;/a&gt;: BsonDocument object model Add methods now throw ArgumentNullException if called with a C# null argument.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/8cad37b22079abde35b3dbdfbe6cd6e023d0fa5e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/8cad37b22079abde35b3dbdfbe6cd6e023d0fa5e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="557757" author="xgen-internal-githook" created="Mon, 21 Apr 2014 18:25:43 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-509&quot; title=&quot;Remove superfluous Create methods and change how remaining Create methods handle C# null&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-509&quot;&gt;&lt;del&gt;CSHARP-509&lt;/del&gt;&lt;/a&gt;: Change how BsonValue Create methods handle C# null.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/2bd507b5b9422346422beedbeea8b1840d92373b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/2bd507b5b9422346422beedbeea8b1840d92373b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="557756" author="xgen-internal-githook" created="Mon, 21 Apr 2014 18:25:41 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-509&quot; title=&quot;Remove superfluous Create methods and change how remaining Create methods handle C# null&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-509&quot;&gt;&lt;del&gt;CSHARP-509&lt;/del&gt;&lt;/a&gt;: Remove superfluous Create methods.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/010bfa578a4450afd96dee07ad5cc7da5b7d844d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/010bfa578a4450afd96dee07ad5cc7da5b7d844d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="274621" author="rstam" created="Sun, 24 Feb 2013 18:55:23 +0000"  >&lt;p&gt;This work was prototyped on the experimental x2.0 branch. This ticket is being reopened for eventual porting to the official 2.0 branch.&lt;/p&gt;</comment>
                            <comment id="162700" author="auto" created="Mon, 10 Sep 2012 22:19:11 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2012-09-10T14:54:59-07:00&apos;, u&apos;email&apos;: u&apos;craiggwilson@gmail.com&apos;, u&apos;name&apos;: u&apos;Craig Wilson&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-509&quot; title=&quot;Remove superfluous Create methods and change how remaining Create methods handle C# null&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-509&quot;&gt;&lt;del&gt;CSHARP-509&lt;/del&gt;&lt;/a&gt;: added tests for BsonBoolean.Create.&lt;br/&gt;
Branch: x2.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/14e6cccc0c0015a59c1df48c49ad0bb979418640&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/14e6cccc0c0015a59c1df48c49ad0bb979418640&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="162450" author="rstam" created="Mon, 10 Sep 2012 16:46:31 +0000"  >&lt;p&gt;Fixed as part of some work on the linked JIRA issues.&lt;/p&gt;</comment>
                            <comment id="162449" author="rstam" created="Mon, 10 Sep 2012 16:45:35 +0000"  >&lt;p&gt;Now that we have removed most Create methods in favor of using the constructors directly and removed the special handling of C# null in functional construction (where it used to mean skip this value), we have also now changed the remaining Create methods to map C# null to BsonNull.Value, since we no longer depend on the Create methods letting C# null flow through them.&lt;/p&gt;

&lt;p&gt;So now BsonBoolean.Create(null) will throw an exception because C# null can&apos;t be mapped to a return type of BsonBoolean, but BsonValue.Create(null) will return BsonNull.Value, which does in fact return false when ToBoolean() is called.&lt;/p&gt;</comment>
                            <comment id="141294" author="rstam" created="Tue, 10 Jul 2012 14:03:29 +0000"  >&lt;p&gt;Changed the summary description to reflect that while the issue was initially filed for BsonBoolean.Create(&quot;false&quot;) it evolved into the more general question of what BsonBoolean.Create(null) should return.&lt;/p&gt;</comment>
                            <comment id="141293" author="rstam" created="Tue, 10 Jul 2012 14:01:09 +0000"  >&lt;p&gt;You make a good point, but currently all the BsonXyz.Create methods return C# null when passed a C# null, and we would have to change all of them to be consistent. This would also require changing the return type of BsonBoolean.Create from BsonBoolean to BsonValue because otherwise BsonNull.Value would be an invalid return value (and similarly for all the other Create methods).&lt;/p&gt;

&lt;p&gt;I&apos;m leaving this open but rescheduling it to 2.0 so that more time can be given to considering what (if anything) we should change. Also, if this ends up requiring breaking changes then 2.0 is a good time for it since 2.0 will have lots of other breaking changes.&lt;/p&gt;</comment>
                            <comment id="135692" author="gfx00" created="Fri, 22 Jun 2012 13:57:35 +0000"  >&lt;p&gt;I got it. &lt;/p&gt;

&lt;p&gt;But then BsonBoolean.Create(null) must be false&lt;br/&gt;
because null and undefined converting are False according to the &lt;a href=&quot;http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf&lt;/a&gt;&lt;/p&gt;
</comment>
                            <comment id="135665" author="rstam" created="Fri, 22 Jun 2012 12:50:22 +0000"  >&lt;p&gt;I can see why this is confusing, but here&apos;s the reasoning behind it:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;the BsonDocument object model is a representation in C# of BSON/JSON documents&lt;/li&gt;
	&lt;li&gt;it therefore follows JavaScript conventions where possible&lt;/li&gt;
	&lt;li&gt;the BsonBoolean.Create method, doesn&apos;t &quot;parse&quot; its argument, it &quot;converts&quot; it&lt;/li&gt;
	&lt;li&gt;the conversion is done following JavaScript conventions&lt;/li&gt;
	&lt;li&gt;and in particular, it follows JavaScript&apos;s somewhat surprising definition of &quot;truthiness&quot;&lt;/li&gt;
	&lt;li&gt;by JavaScript&apos;s definition of &quot;truthiness&quot; the string &quot;false&quot; is considered to be a true value&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;If you actually want to parse the string instead of convert it using JavaScript&apos;s definition of truthiness, then you can write:&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;var value = BsonBoolean.Create(bool.Parse(&quot;false&quot;));&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                            <comment id="135617" author="gfx00" created="Fri, 22 Jun 2012 08:32:56 +0000"  >&lt;p&gt;        case Conversion.StringToBsonBoolean:&lt;br/&gt;
            return BsonBoolean.Create(((string) value) != &quot;&quot;);&lt;/p&gt;

&lt;p&gt;Very good indeed assumption&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="49637">CSHARP-555</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="49917">CSHARP-557</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="205554">CSHARP-1287</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|hrgghb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9582</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="130">Sprint 1 April 14 - May 2</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>