<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:40:48 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-1838] Merge multiple .Where() clauses to a single $match before querying</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1838</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;My first issue here so please correct me if I make any mistakes posting it.&lt;/p&gt;

&lt;p&gt;The aggregation framework that the 2.* driver maps to only uses indexes for the first match (&lt;a href=&quot;https://docs.mongodb.com/v3.2/reference/operator/aggregation/match/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/v3.2/reference/operator/aggregation/match/&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;I often pass aroung IQueryable to multiple layers in my applications that combine .Where(...) clauses to filter the result (depending on user input, access level etc).&lt;/p&gt;

&lt;p&gt;The resulting query that the driver produces translates every .Where() clause to a $match. This results in poor performance since the indexes are only used for the first $match.&lt;/p&gt;

&lt;p&gt;Would it be possible for the driver to combine these $match&apos;es to a single $match?&lt;/p&gt;</description>
                <environment></environment>
        <key id="334232">CSHARP-1838</key>
            <summary>Merge multiple .Where() clauses to a single $match before querying</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="sblomstrand">Sten Blomstrand</reporter>
                        <labels>
                    </labels>
                <created>Fri, 25 Nov 2016 13:06:45 +0000</created>
                <updated>Wed, 11 Jan 2017 22:16:24 +0000</updated>
                            <resolved>Wed, 11 Jan 2017 22:15:59 +0000</resolved>
                                    <version>2.3</version>
                                                    <component>Linq</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1475081" author="rstam" created="Wed, 11 Jan 2017 22:13:54 +0000"  >&lt;p&gt;Looks like the server implemented this optimization a long time ago, in version 2.6:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-11184&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-11184&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1449377" author="sblomstrand" created="Mon, 5 Dec 2016 17:05:25 +0000"  >&lt;p&gt;I what version did this change?&lt;/p&gt;</comment>
                            <comment id="1446019" author="rstam" created="Wed, 30 Nov 2016 18:01:29 +0000"  >&lt;p&gt;Have you tried this with the current version of the server?&lt;/p&gt;

&lt;p&gt;The server is supposed to merge $match stages in which case it should not be necessary for any drivers to do that.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="343600">CSHARP-1887</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <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|hss8af:</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>