<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:40:53 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-1867] Non-nullable members cannot be compared to nullable values</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1867</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;This is a regression from 2.3 -&amp;gt; 2.4. When upgrading to 2.4 it broke all these queries.&lt;/p&gt;

&lt;p&gt;When doing a query such a Find where the filter is &apos;d =&amp;gt; d._id == nullableId&apos; where nullableId is a Guid? (Nullable&amp;lt;Guid&amp;gt;) there is a unsupported filter exception that throws. Here is the exception: System.ArgumentException: Unsupported filter: (Convert(&lt;/p&gt;
{document}
&lt;p&gt;{_id}) == 61d29f4c-7e8a-4eb6-b7ce-c1cbbc9cd1b2).&lt;/p&gt;

&lt;p&gt;More info:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;we do a BsonRepresentation(BsonType.String) for all of our guids&lt;/li&gt;
	&lt;li&gt;changing the query to d =&amp;gt; d._id == nullableId.Value fixes the issue&lt;/li&gt;
	&lt;li&gt;this is a regression&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This is a non blocking issue because we can just add .Value to the nullable guid and it works&lt;/p&gt;

&lt;p&gt;Note: this actually applies to all non-nullable members compared to nullable values, not just Guid.&lt;/p&gt;</description>
                <environment></environment>
        <key id="338640">CSHARP-1867</key>
            <summary>Non-nullable members cannot be compared to nullable values</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="Gekctek">Ethan [X]</reporter>
                        <labels>
                    </labels>
                <created>Tue, 13 Dec 2016 21:43:48 +0000</created>
                <updated>Fri, 3 Mar 2017 22:11:04 +0000</updated>
                            <resolved>Mon, 19 Dec 2016 16:37:21 +0000</resolved>
                                    <version>2.3</version>
                                    <fixVersion>2.4.1</fixVersion>
                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1461170" author="xgen-internal-githook" created="Mon, 19 Dec 2016 16:36:24 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;rstam&apos;, u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@robertstam.org&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1867&quot; title=&quot;Non-nullable members cannot be compared to nullable values&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1867&quot;&gt;&lt;del&gt;CSHARP-1867&lt;/del&gt;&lt;/a&gt;: Non-nullable members cannot be compared to nullable values.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/e7f872afc0b620d6540af70d8a0f6d7b25ee82bd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/e7f872afc0b620d6540af70d8a0f6d7b25ee82bd&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1458061" author="rstam" created="Wed, 14 Dec 2016 17:09:39 +0000"  >&lt;p&gt;We have discussed this internally and decided that even though comparing a non-nullable member to a nullable value is questionable since there should never be nulls, this happens often enough and there is a reasonable interpretation that can be made of the query, that we will start to support this officially going forward.&lt;/p&gt;

&lt;p&gt;There are two scenarios:&lt;/p&gt;

&lt;p&gt;1. The right hand value is not null. In this case we will interpret the query exactly the same as if the value had not been nullable. In other words, we will generate:&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;{ nonNullableFieldName : nullableValue.Value }&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;2. The right hand value is null. In this case we will generate:&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;{ nonNullableFieldName : null }&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;If the documents in the database were all created by serializing the POCO with the non-nullable member, there should be NO documents matching this query.&lt;/p&gt;

&lt;p&gt;Note: if there do happen to be any documents with a null for the non-nullable field, an exception will be thrown if you attempt to deserialize such documents into the POCO, because null is not a valid value for a non-nullable member.&lt;/p&gt;</comment>
                            <comment id="1457093" author="rstam" created="Wed, 14 Dec 2016 00:47:53 +0000"  >&lt;p&gt;I can confirm that this sort of worked in 2.3. It works if the nullableId value is &lt;b&gt;not&lt;/b&gt; null, otherwise a NullReferenceException is thrown (which would be a bug).&lt;/p&gt;

&lt;p&gt;I can also confirm that in 2.4 an exception is thrown whether or not the nullableId value is null or not.&lt;/p&gt;

&lt;p&gt;This is actually by design. See &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-506&quot; title=&quot;Throw better exception when comparing a non-nullable field to a nullable value&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-506&quot;&gt;&lt;del&gt;CSHARP-506&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, while the exception correctly identifies the expression that is not supported, it doesn&apos;t say why, which is confusing. It is too easy to conclude that this is a bug rather than working this way by design.&lt;/p&gt;

&lt;p&gt;I&apos;m going to leave this ticket open for now so we can discuss whether the decision made in &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-506&quot; title=&quot;Throw better exception when comparing a non-nullable field to a nullable value&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-506&quot;&gt;&lt;del&gt;CSHARP-506&lt;/del&gt;&lt;/a&gt; was right or not.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="338270">CSHARP-1865</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="234913">CSHARP-1453</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="162992">CSHARP-1083</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="338270">CSHARP-1865</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="203293">CSHARP-1273</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="41884">CSHARP-506</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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrev2v:</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>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1431">C# Sprint 46</customfieldvalue>

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