<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:40:32 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-1734] The FilterDefinition renders errorneously when Any is used inside another Any operator.</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1734</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;The following code sequence is used to generate the error:&lt;/p&gt;

&lt;p&gt;      var documentSerializer = BsonSerializer.SerializerRegistry.GetSerializer&amp;lt;T&amp;gt;();&lt;br/&gt;
      var renderedFilter = filterDefinition.Render(documentSerializer, BsonSerializer.SerializerRegistry).ToString();&lt;/p&gt;

&lt;p&gt;The FilterDefinition contains the expression obtained from:&lt;/p&gt;

&lt;p&gt; tours.Where(tour =&amp;gt; tour.CarrierAssociations.Any(x =&amp;gt; x.CarrierId == myOrganizationId &amp;amp;&amp;amp; x.States.Any(y =&amp;gt; y.State == TourState.AcceptPending))).ToList();&lt;/p&gt;

&lt;p&gt;The output is:&lt;/p&gt;

&lt;p&gt;{ &quot;carrierAssociations&quot; : { &quot;$elemMatch&quot; : &lt;/p&gt;
{ &quot;carrierId&quot; : NumberLong(22), &quot;state&quot; : 0 }
&lt;p&gt; } }&lt;/p&gt;

&lt;p&gt;which is not correct, because &quot;state&quot; is an array of subdocuments, which in turn contain a &quot;state&quot; field. I assume the correct output would have been:&lt;/p&gt;

&lt;p&gt;{ &quot;carrierAssociations&quot; : { &quot;$elemMatch&quot; : &lt;/p&gt;
{ &quot;carrierId&quot; : NumberLong(22), &quot;state.state&quot; : 0 }
&lt;p&gt; } }&lt;/p&gt;

&lt;p&gt;or something like that. Note: the &quot;state&quot; names that appear in the JSON are field names specified with the BsonElement attribute, so please do not be confused about them. I don&apos;t know exactly which &quot;state&quot; does the output refer to: the &quot;States&quot; collection property, or the &quot;State&quot; within the the elements of this collection - by chance they have the same BSON element name.&lt;/p&gt;

&lt;p&gt;I marked it as critical because we have this problem in production, and we do not have at least a workaround for this. Moreover, we identified this in one place, but we are not sure if the application code contains other similar queries, which we did not identified yet, and which could cause hidden bugs.&lt;/p&gt;</description>
                <environment>Windows 10 x64</environment>
        <key id="306738">CSHARP-1734</key>
            <summary>The FilterDefinition renders errorneously when Any is used inside another Any operator.</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="craig.wilson@mongodb.com">Craig Wilson</assignee>
                                    <reporter username="ioan.crisan@soloplan.de">Ioan Crisan</reporter>
                        <labels>
                    </labels>
                <created>Fri, 5 Aug 2016 06:30:50 +0000</created>
                <updated>Fri, 23 Sep 2016 19:50:34 +0000</updated>
                            <resolved>Tue, 9 Aug 2016 15:48:34 +0000</resolved>
                                    <version>2.2.4</version>
                                    <fixVersion>2.3</fixVersion>
                                    <component>Linq</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="1351568" author="xgen-internal-githook" created="Tue, 9 Aug 2016 15:50:45 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;craiggwilson&apos;, u&apos;name&apos;: u&apos;Craig Wilson&apos;, u&apos;email&apos;: u&apos;craiggwilson@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1734&quot; title=&quot;The FilterDefinition renders errorneously when Any is used inside another Any operator.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1734&quot;&gt;&lt;del&gt;CSHARP-1734&lt;/del&gt;&lt;/a&gt;: fixing issue related to nested Any clauses with conjunctions.&lt;br/&gt;
Branch: v2.4.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/7f2ce4a85d46fca4f48cce6a2121f74a8b47dfcc&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/7f2ce4a85d46fca4f48cce6a2121f74a8b47dfcc&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1351559" author="xgen-internal-githook" created="Tue, 9 Aug 2016 15:48:25 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;craiggwilson&apos;, u&apos;name&apos;: u&apos;Craig Wilson&apos;, u&apos;email&apos;: u&apos;craiggwilson@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1734&quot; title=&quot;The FilterDefinition renders errorneously when Any is used inside another Any operator.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1734&quot;&gt;&lt;del&gt;CSHARP-1734&lt;/del&gt;&lt;/a&gt;: fixing issue related to nested Any clauses with conjunctions.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/7f2ce4a85d46fca4f48cce6a2121f74a8b47dfcc&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/7f2ce4a85d46fca4f48cce6a2121f74a8b47dfcc&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1350336" author="ioan.crisan@soloplan.de" created="Mon, 8 Aug 2016 16:54:21 +0000"  >&lt;p&gt;Thanks for the hint. We will try to see what we can do in such cases, but we definitely would prefer a driver solution.&lt;/p&gt;</comment>
                            <comment id="1348287" author="craiggwilson" created="Fri, 5 Aug 2016 12:14:32 +0000"  >&lt;p&gt;In the meantime, if this is a production problem, you can always step back and not use LINQ for this particular query, but rather use the Builders API and/or manually build up a BsonDocument.&lt;/p&gt;</comment>
                            <comment id="1348286" author="craiggwilson" created="Fri, 5 Aug 2016 12:13:50 +0000"  >&lt;p&gt;Hi Ioan,&lt;/p&gt;

&lt;p&gt;I&apos;ll take a look and see if I can fix it for our next 2.3 release. Depending on complexity, I may push it until later. However, &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1445&quot; title=&quot;Support arbitrary filters  in the LINQ provider.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1445&quot;&gt;&lt;del&gt;CSHARP-1445&lt;/del&gt;&lt;/a&gt; will provide you a workaround in 2.3 if I can&apos;t get this one done.&lt;/p&gt;

&lt;p&gt;Craig&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|hsodwf:</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="1189">C# Sprint 40</customfieldvalue>

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