<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:08: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>[SERVER-25038] Comparisons made by $bucket at parse time must respect the collation</title>
                <link>https://jira.mongodb.org/browse/SERVER-25038</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The difficulty is that parsing of the aggregation pipeline is done before lock acquisition, but the final collation is not always known until after the collection lock has been acquired (since we may need to read the collection&apos;s metadata describing the collection default collation). &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=max.hirschhorn&quot; class=&quot;user-hover&quot; rel=&quot;max.hirschhorn&quot;&gt;max.hirschhorn&lt;/a&gt; and myself brainstormed a few potential solutions:&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;Parse the aggregation pipeline under the lock so we know what the collation is.&lt;/li&gt;
	&lt;li&gt;Remove the comparisons and let users create buckets that will always be empty.&lt;/li&gt;
	&lt;li&gt;Configure the $group stage to do the checks that require collation by making it aware that it&apos;s a $group for bucketing.&lt;/li&gt;
	&lt;li&gt;Create a DocumentSourceBucket class that during its optimize() method does these checks, adds a DocumentSourceGroup and DocumentSourceSort to the pipeline, and then removes itself from the pipeline.&lt;/li&gt;
&lt;/ol&gt;
</description>
                <environment></environment>
        <key id="300756">SERVER-25038</key>
            <summary>Comparisons made by $bucket at parse time must respect the collation</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="david.storch@mongodb.com">David Storch</assignee>
                                    <reporter username="david.storch@mongodb.com">David Storch</reporter>
                        <labels>
                    </labels>
                <created>Wed, 13 Jul 2016 15:06:09 +0000</created>
                <updated>Sat, 19 Nov 2016 00:06:31 +0000</updated>
                            <resolved>Tue, 4 Oct 2016 20:01:18 +0000</resolved>
                                                    <fixVersion>3.4.0-rc1</fixVersion>
                                    <component>Aggregation Framework</component>
                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="1400079" author="xgen-internal-githook" created="Tue, 4 Oct 2016 20:00:38 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;dstorch&apos;, u&apos;name&apos;: u&apos;David Storch&apos;, u&apos;email&apos;: u&apos;david.storch@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-25038&quot; title=&quot;Comparisons made by $bucket at parse time must respect the collation&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-25038&quot;&gt;&lt;del&gt;SERVER-25038&lt;/del&gt;&lt;/a&gt; make LiteParsedDocumentSource destructor virtual&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/5396d9b72eea0d0d0086150eccf8c3b8ef710064&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/5396d9b72eea0d0d0086150eccf8c3b8ef710064&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1399192" author="xgen-internal-githook" created="Mon, 3 Oct 2016 20:20:51 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;dstorch&apos;, u&apos;name&apos;: u&apos;David Storch&apos;, u&apos;email&apos;: u&apos;david.storch@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-25038&quot; title=&quot;Comparisons made by $bucket at parse time must respect the collation&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-25038&quot;&gt;&lt;del&gt;SERVER-25038&lt;/del&gt;&lt;/a&gt; add LiteParsedPipeline&lt;/p&gt;

&lt;p&gt;This provides a way to do pre-parse validity checks. Full&lt;br/&gt;
parsing of the Pipeline must be done under the collection&lt;br/&gt;
lock, when the collation is known.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/8758a5c7be68effbc4a1f857787bfb7b201c6389&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/8758a5c7be68effbc4a1f857787bfb7b201c6389&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1353006" author="charlie.swanson" created="Wed, 10 Aug 2016 16:30:06 +0000"  >&lt;p&gt;Code review url: &lt;a href=&quot;https://mongodbcr.appspot.com/86280001/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://mongodbcr.appspot.com/86280001/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1331374" author="max.hirschhorn@10gen.com" created="Thu, 21 Jul 2016 15:33:35 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=david.storch&quot; class=&quot;user-hover&quot; rel=&quot;david.storch&quot;&gt;david.storch&lt;/a&gt;, I discussed this ticket a bit more with Charlie and he suggested adding a non-documented, internal option to &lt;tt&gt;ExpressionSwitch&lt;/tt&gt; that verifies its case statements are sorted and returns an error if they aren&apos;t. This proposal is more akin to #3 in the list in the ticket&apos;s description, but at the level of the expression and not the stage. The argument against doing #4 is that it is currently possible to run a non-optimized pipeline and that would no longer be the case if a &lt;tt&gt;DocumentSourceBucket&lt;/tt&gt; instance was added to the pipeline - there&apos;d be no reason to give &lt;tt&gt;DocumentSourceBucket::getNext()&lt;/tt&gt; a real implementation because it is expected to replace itself with a &lt;tt&gt;DocumentSourceGroup&lt;/tt&gt; and a &lt;tt&gt;DocumentSourceSort&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;There is a separate consideration that we should give for work on this ticket related to when expressions specified in $bucket are optimized. In the current implementation in the specification in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-23815&quot; title=&quot;Add $bucket aggregation stage&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-23815&quot;&gt;&lt;del&gt;SERVER-23815&lt;/del&gt;&lt;/a&gt;, the boundaries are allowed to be expressions that resolve to constants (when &lt;tt&gt;optimized()&lt;/tt&gt;&apos;d) and aren&apos;t just constants themselves.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&apos;boundaries&apos; must be constant values (can&apos;t use &quot;$x&quot;, but can use {&lt;tt&gt;$add: [4, 5]&lt;/tt&gt;}), and must be sorted.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;While it is currently the case that we don&apos;t resolve the &lt;tt&gt;$cond&lt;/tt&gt; expression to an &lt;tt&gt;ExpressionConstant&lt;/tt&gt; unless all &lt;em&gt;three&lt;/em&gt; of its operands can be resolved to constants, we may in the future want to optimize cases like the following to simply be the &quot;then&quot; or &quot;else&quot; expression.&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;{$cond: [{$eq: [&quot;foo&quot;, &quot;FOO&quot;]}, &quot;$x&quot;, 0]}&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;However, we would need to know the correct collation to compare &quot;foo&quot; and &quot;FOO&quot; under in order to do so. &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=asya&quot; class=&quot;user-hover&quot; rel=&quot;asya&quot;&gt;asya&lt;/a&gt;, are we willing to change the specification for $bucket to only accept constants and not expressions that resolve to constants in order to simplify some of the integration with collation in $bucket? Otherwise if we go with Charlie&apos;s proposal, we&apos;d want to defer those checks to &lt;tt&gt;$switch&lt;/tt&gt; as well.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <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_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 21 Jul 2016 15:33:35 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        7 years, 19 weeks, 1 day ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-266</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            7 years, 19 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>charlie.swanson@mongodb.com</customfieldvalue>
            <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>max.hirschhorn@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrk2rj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrcuwv:</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_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1146">Query 18 (08/05/16)</customfieldvalue>
    <customfieldvalue id="1208">Query 2016-08-29</customfieldvalue>
    <customfieldvalue id="1209">Query 2016-09-19</customfieldvalue>
    <customfieldvalue id="1294">Query 2016-10-10</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrjd13:</customfieldvalue>

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