<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:41:06 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-1929] Using array in Expression Filter throws an exception</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1929</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;I am currently trying to update our MongoDB references to the latest (2.4.2) to allow our DBA team to upgrade our environments to the latest Mongo 3.4.&lt;/p&gt;

&lt;p&gt;Updating the references using Nugget packages has shown a breaking changes affecting our production code and stopping us from a smooth upgrade.&lt;/p&gt;

&lt;p&gt;the issue: when using a nullable type array in the Expression (Func) filter - the mongoC# Driver throws an exception: &lt;/p&gt;

{&quot;Unable to cast object of type &apos;MongoDB.Bson.Serialization.Serializers.ArraySerializer`1[System.Nullable`1[System.Guid]]&apos; to type &apos;MongoDB.Bson.Serialization.IBsonSerializer`1[System.Guid]&apos;.&quot;}

&lt;p&gt;I have added a small app on my github that replicate the issue if that can be of any help. &lt;/p&gt;

&lt;p&gt;I am not sure if this was the right channel to log the issue and I want to apoloy if this was not the case.&lt;/p&gt;

&lt;p&gt;The github address for the relevant repository: &lt;a href=&quot;https://github.com/Sifou13/MongoNullableArrayFilterIssue&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/Sifou13/MongoNullableArrayFilterIssue&lt;/a&gt;&lt;/p&gt;</description>
                <environment>Local environment (Developer Machine)</environment>
        <key id="359616">CSHARP-1929</key>
            <summary>Using array in Expression Filter throws an exception</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="Sifou">Sif-eydine Ounas [X]</reporter>
                        <labels>
                            <label>Bug</label>
                    </labels>
                <created>Wed, 1 Mar 2017 14:06:00 +0000</created>
                <updated>Tue, 7 Mar 2017 21:17:51 +0000</updated>
                            <resolved>Tue, 7 Mar 2017 21:17:33 +0000</resolved>
                                    <version>2.4.2</version>
                                    <fixVersion>2.4.3</fixVersion>
                                    <component>Serialization</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1518301" author="rstam" created="Tue, 7 Mar 2017 21:16:41 +0000"  >&lt;p&gt;This appears to be a duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1777&quot; title=&quot;Regression 2.3 driver- Nullible List Contains operator&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1777&quot;&gt;&lt;del&gt;CSHARP-1777&lt;/del&gt;&lt;/a&gt;, which is fixed in 2.4.3.&lt;/p&gt;</comment>
                            <comment id="1513213" author="sifou" created="Wed, 1 Mar 2017 14:18:34 +0000"  >&lt;p&gt;If interested parties in the community don&apos;t have the tools to run the app, the bug happens in the second statement below:&lt;/p&gt;

&lt;p&gt; Guid?[] myLookupArray = new Guid?[]&lt;/p&gt;
{ Value1};&lt;br/&gt;
&lt;br/&gt;
List&amp;lt;MyObject&amp;gt; retrievedObjects = Find&amp;lt;MyObject&amp;gt;(x =&amp;gt; &lt;b&gt;myLookupArray.Contains(x.myValue)&lt;/b&gt;).Result; &lt;br/&gt;
&lt;br/&gt;
and a workaround for now is to change the two lines as follow:&lt;br/&gt;
&lt;br/&gt;
 Guid[] myLookupArray = new Guid[] { Value1}
&lt;p&gt;;(removed the ? for nullable)&lt;/p&gt;

&lt;p&gt;List&amp;lt;MyObject&amp;gt; retrievedObjects = Find&amp;lt;MyObject&amp;gt;(x =&amp;gt; &lt;b&gt;x.myValue.HasValue &amp;amp;&amp;amp;&lt;/b&gt; myLookupArray.Contains(x.myValue &lt;b&gt;.Value&lt;/b&gt; )).Result;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="321334">CSHARP-1777</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|hrb13z:</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="1636">C# Sprint 50</customfieldvalue>

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