<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:54:44 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-84338] Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results</title>
                <link>https://jira.mongodb.org/browse/SERVER-84338</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;&lt;b&gt;Observable Problem&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;When running a query/aggregation with a $or, the SBE plan cache entry may store an invalid plan. This results in subsequent executions of the query, with different constants, returning incorrect results. In particular, the cached plan may incorrectly filter out documents which should be returned. This problem is specific to SBE and the SBE plan cache. The classic engine is not affected.&lt;/p&gt;

&lt;p&gt;Under 7.0.4, 7.1,7.2, this bug affects find() commands, since SBE is on by default.&lt;/p&gt;

&lt;p&gt;In the v7.0 branch and master branch, this bug affects only aggregations, since SBE use is restricted to a smaller set of queries (see &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-83685&quot; title=&quot;Make internalQueryFrameworkControl &amp;quot;trySbeRestricted&amp;quot; the default query knob&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-83685&quot;&gt;&lt;del&gt;SERVER-83685&lt;/del&gt;&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Reproduction with resmoke&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;To reproduce the bug, see &lt;tt&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt;-repro-2.js&lt;/tt&gt; and run it with resmoke:&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;python3 buildscripts/resmoke.py run --suites=no_passthrough_with_mongod SERVER-&lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;84338&lt;/span&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;-repro-&lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;2&lt;/span&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;.js&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;The script will run several tests against mongod, reconfiguring its &lt;tt&gt;internalQueryFrameworkControl&lt;/tt&gt; value to &lt;tt&gt;trySbeEngine&lt;/tt&gt;, &lt;tt&gt;trySbeRestricted&lt;/tt&gt; and &lt;tt&gt;forceClassicEngine&lt;/tt&gt;. At the end, it will print out a list of queries and configurations that produced incorrect results.&lt;/p&gt;

&lt;p&gt;Under default configuration, which is &lt;tt&gt;trySbeRestricted&lt;/tt&gt;, both 7.0 and master can produce incorrect results for an aggregation of this form:&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;   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;[&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;$match&quot;&lt;/span&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; : {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; &#160; &#160; &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;$or&quot;&lt;/span&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; : [&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;_id&quot;&lt;/span&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; : &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;2&lt;/span&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;,&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;foo&quot;&lt;/span&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; : &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;2&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; },&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;_id&quot;&lt;/span&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; : &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;2&lt;/span&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;,&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;foo&quot;&lt;/span&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; : &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;999&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; &#160; &#160; ]&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; },&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; &#160; &#160; &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;$count&quot;&lt;/span&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; : &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;count&quot;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;&#160; &#160; }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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;]&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;&#160;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Explanation of the bug&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The bug has to do with the interaction between top-level $ors, the $or -&amp;gt; $in rewrite, and the plan cache.&lt;/p&gt;

&lt;p&gt;A query with the filter of the form&#160;{$or: {_id: 1, foo: 1}, {_id: 1, foo:999}} comes in, and is optimized/normalized, and parameterized as usual. Optimizing this expression does not change the expression (the _id predicate is not pulled up).&lt;/p&gt;

&lt;p&gt;Each branch of the OR is then planned separately, using an index scan on _id and a residual filter on &lt;tt&gt;foo&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;The planner then realizes that the scans generated beneath the OR are identical, and collapses them into one in &lt;a href=&quot;https://github.com/10gen/mongo/blob/ecb1c5958e7d4848458801da9447658feb602050/src/mongo/db/query/planner_access.cpp#L1272C49-L1272C92&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;QueryPlannerAccess::collapseEquivalentScans().&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When collapsing the scans, we combine the residual filters on &lt;tt&gt;foo&lt;/tt&gt; into&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;{ $or: [ { foo: { $eq: &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;999.0&lt;/span&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; } }, { foo: { $eq: &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;1.0&lt;/span&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; } } ] } &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;We then optimize this expression &lt;a href=&quot;https://github.com/10gen/mongo/blob/ecb1c5958e7d4848458801da9447658feb602050/src/mongo/db/query/planner_access.cpp#L1313-L1314&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; which converts the $or to a $in &lt;a href=&quot;https://github.com/10gen/mongo/blob/ecb1c5958e7d4848458801da9447658feb602050/src/mongo/db/matcher/expression_tree.cpp#L340&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;. The optimized residual predicate is:&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;{foo: {$in: [&lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;1&lt;/span&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;, &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;999&lt;/span&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;]}} &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;The resulting $in does not preserve the parameter IDs assigned to each predicate on foo. This is the crux of the problem: that parameterization information has effectively been &quot;lost.&quot;&lt;/p&gt;

&lt;p&gt;At this point, the $in right hand side is effectively &quot;baked&quot; into the query plan which is cached. Subsequent executions will use &lt;tt&gt;1, 999&lt;/tt&gt; in the residual predicate even if those are not the values provided.&lt;/p&gt;

&lt;p&gt;The attached &lt;tt&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt;-repro-2.js&lt;/tt&gt; contains more details, as well as some information about queries which are similar but do not exhibit the bug.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Next Steps&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The remaining tasks here are:&lt;/p&gt;

&lt;p&gt;(a) Determine the expected/desired interaction between match expression optimization and parameterization. This was probably discussed during the plan cache development. The repro script includes a similar situation where the bug does &lt;em&gt;not&lt;/em&gt; reproduce, but it is not clear whether this is intentional, or whether it is just by chance.&lt;/p&gt;

&lt;p&gt;(b) Fix the bug.&lt;/p&gt;

&lt;p&gt;(c) Determine a testing strategy so we can catch this type of bug on our own.&lt;/p&gt;

&lt;p&gt;(d) Investigate whether there are other cases where we can store an invalid plan in the cache. Any time we optimize a match expression after parameterization, we are at risk of this bug occurring, since the optimization can effectively &quot;lose&quot; parameter markings. I did a quick check of the planning code and couldn&apos;t find other places where we call MatchExpression::optimize() besides the on linked above when collapsing scans beneath an OR.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Original Description Provided by Customer&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Given a query, `findOne({$or: &lt;span class=&quot;error&quot;&gt;&amp;#91;query, query&amp;#93;&lt;/span&gt;})` does not yield the same results as `findOne(query)`.&lt;/p&gt;

&lt;p&gt;It works fine in 6.0&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Description of Attached Files&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;index.mjs&lt;/tt&gt;: Original reproduction provided by customer&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt;-repro.js: Reproduction script from Kyle Suarez, which runs the server under several configurations.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt;-repro-2.js: Final repro script from Ian B, which supersedes the prior two. This file includes detailed notes on the bug, along with some different queries which do not exhibit the bug. This file, along with the resmoke command in the description, should be all that is needed to reproduce and understand the bug.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2529803">SERVER-84338</key>
            <summary>Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results</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="13201">Fixed</resolution>
                                        <assignee username="ben.shteinfeld@mongodb.com">Ben Shteinfeld</assignee>
                                    <reporter username="mika.fischer@zoopnet.de">Mika Fischer</reporter>
                        <labels>
                            <label>auto-reverted</label>
                    </labels>
                <created>Wed, 20 Dec 2023 15:43:26 +0000</created>
                <updated>Wed, 24 Jan 2024 00:56:05 +0000</updated>
                            <resolved>Thu, 18 Jan 2024 01:45:36 +0000</resolved>
                                    <version>7.1.0</version>
                    <version>7.0.4</version>
                    <version>7.3.0-rc0</version>
                    <version>7.2.0</version>
                                    <fixVersion>7.2.1</fixVersion>
                    <fixVersion>7.3.0-rc0</fixVersion>
                    <fixVersion>7.0.6</fixVersion>
                                                        <votes>0</votes>
                                    <watches>15</watches>
                                                                                                                <comments>
                            <comment id="6020329" author="JIRAUSER1269946" created="Thu, 18 Jan 2024 01:48:24 +0000"  >&lt;p&gt;Original fix and backports were reverted due to a test failure in a timeseries passthrough suite which interacted poorly with the planCacheClear command. I&apos;ve re-submitted the fix into master (7.3), 7.2, and 7.0 branches.&lt;/p&gt;</comment>
                            <comment id="6019945" author="xgen-internal-githook" created="Thu, 18 Jan 2024 00:09:42 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;ben.shteinfeld@mongodb.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt; Avoid $or-&amp;gt;$in rewrite if operand is a parameter (2nd attempt) (#17992)&lt;/p&gt;

&lt;p&gt;GitOrigin-RevId: eebb08ddd00c5b94055e19d30ad22c697d983e1c&lt;br/&gt;
Branch: v7.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/dfad62cd9ec44fd265e256ea199f342f4c5cfa02&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/dfad62cd9ec44fd265e256ea199f342f4c5cfa02&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="6014991" author="xgen-internal-githook" created="Tue, 16 Jan 2024 19:16:24 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;ben.shteinfeld@mongodb.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt; Avoid $or-&amp;gt;$in rewrite if operand is a parameter (2nd attempt) (#17992)&lt;br/&gt;
Branch: v7.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/c6e4ede5cc8a57f887c2e3ba149ec6d89a5de5c2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/c6e4ede5cc8a57f887c2e3ba149ec6d89a5de5c2&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="6006258" author="xgen-internal-githook" created="Fri, 12 Jan 2024 04:14:00 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;ben.shteinfeld@mongodb.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt; Avoid $or-&amp;gt;$in rewrite if operand is a parameter (#17992)&lt;/p&gt;

&lt;p&gt;GitOrigin-RevId: 31710a31b24c5b2d62dd1363567b2541dbfeee27&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/20cf2d127b94e0c7d798690edc9aa5546eacd745&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/20cf2d127b94e0c7d798690edc9aa5546eacd745&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="6003943" author="xgen-internal-githook" created="Thu, 11 Jan 2024 14:58:38 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;ben.shteinfeld@mongodb.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: Revert &quot;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt; Avoid $or-&amp;gt;$in rewrite if operand is a parameter (#17885)&quot;&lt;/p&gt;

&lt;p&gt;This reverts commit 375c60714f242e8024fb10adb31aab94ac454fa1.&lt;br/&gt;
Branch: v7.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/43ad1003471f5887edf1f8adc868260a38ca3149&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/43ad1003471f5887edf1f8adc868260a38ca3149&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="6003928" author="xgen-internal-githook" created="Thu, 11 Jan 2024 14:56:08 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;ben.shteinfeld@mongodb.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: Revert &quot;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt; Avoid $or-&amp;gt;$in rewrite if operand is a parameter (#17885)&quot;&lt;/p&gt;

&lt;p&gt;This reverts commit a57bdc3ccc66c1016928c7f7d5292705a32a9181.&lt;/p&gt;

&lt;p&gt;GitOrigin-RevId: 6c185c0b4028672ec15f476fe1798cc2260d1df0&lt;br/&gt;
Branch: v7.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/dd436240ed58ea9cdac505061b0852d16875f9ee&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/dd436240ed58ea9cdac505061b0852d16875f9ee&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="6002659" author="xgen-internal-githook" created="Thu, 11 Jan 2024 01:42:02 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;auto-revert-processor&apos;, &apos;email&apos;: &apos;dev-prod-dag@mongodb.com&apos;, &apos;username&apos;: &apos;&apos;}
&lt;p&gt;Message: Revert &quot;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt; Avoid $or-&amp;gt;$in rewrite if operand is a parameter (#17885)&quot;&lt;/p&gt;

&lt;p&gt;This reverts commit b96ac705e7c6801d9ecfd7b879dc9819060982fe.&lt;/p&gt;

&lt;p&gt;GitOrigin-RevId: 0ca548ff9d7b52c4ddbd0de078284fbc765e2e34&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/e74b6cdd6cc675c89093df23481f6ca4d8199476&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/e74b6cdd6cc675c89093df23481f6ca4d8199476&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="6002205" author="xgen-internal-githook" created="Wed, 10 Jan 2024 22:16:33 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;bshteinfeld@users.noreply.github.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt; Avoid $or-&amp;gt;$in rewrite if operand is a parameter (#17885)&lt;/p&gt;

&lt;p&gt;(cherry picked from commit b96ac705e7c6801d9ecfd7b879dc9819060982fe)&lt;/p&gt;

&lt;p&gt;GitOrigin-RevId: a57bdc3ccc66c1016928c7f7d5292705a32a9181&lt;br/&gt;
Branch: v7.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/5a10503b0c1ec28f986640748582e95c2725d19c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/5a10503b0c1ec28f986640748582e95c2725d19c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="6001945" author="xgen-internal-githook" created="Wed, 10 Jan 2024 20:55:37 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;bshteinfeld@users.noreply.github.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt; Avoid $or-&amp;gt;$in rewrite if operand is a parameter (#17885)&lt;/p&gt;

&lt;p&gt;(cherry picked from commit b96ac705e7c6801d9ecfd7b879dc9819060982fe)&lt;br/&gt;
Branch: v7.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/375c60714f242e8024fb10adb31aab94ac454fa1&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/375c60714f242e8024fb10adb31aab94ac454fa1&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="6001430" author="xgen-internal-githook" created="Wed, 10 Jan 2024 18:39:00 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;bshteinfeld@users.noreply.github.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84338&quot; title=&quot;Top level $or queries may lead to invalid SBE plan cache entry which returns wrong results&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84338&quot;&gt;&lt;del&gt;SERVER-84338&lt;/del&gt;&lt;/a&gt; Avoid $or-&amp;gt;$in rewrite if operand is a parameter (#17885)&lt;/p&gt;

&lt;p&gt;GitOrigin-RevId: b96ac705e7c6801d9ecfd7b879dc9819060982fe&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/d3f0b18e7e2a3efa4cc2e6ed27934e09096f6574&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/d3f0b18e7e2a3efa4cc2e6ed27934e09096f6574&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5981603" author="ian.boros" created="Tue, 2 Jan 2024 22:43:46 +0000"  >&lt;p&gt;Investigation is ongoing, but I&apos;ve narrowed down the bug to a problematic interaction between match expression optimization and auto parameterization.&lt;/p&gt;

&lt;p&gt;There&apos;s another patch that interacts with this: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-83685&quot; title=&quot;Make internalQueryFrameworkControl &amp;quot;trySbeRestricted&amp;quot; the default query knob&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-83685&quot;&gt;&lt;del&gt;SERVER-83685&lt;/del&gt;&lt;/a&gt;, which landed in master and the 7.0 branch, due to be released in 7.0.5. &lt;b&gt;Since 83685 turns off SBE for most queries, the bug should no longer affect the query provided in the ticket, or any find() queries in 7.0.5.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;However, agregations with a similar predicate and an SBE-eligible $group or $lookup may still be affected despite the changes from 83685.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="5965519" author="JIRAUSER1265262" created="Thu, 21 Dec 2023 12:22:24 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=haser%40videmo.de&quot; class=&quot;user-hover&quot; rel=&quot;haser@videmo.de&quot;&gt;haser@videmo.de&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Thanks for sharing your findings here, and providing a clear reproducer script. We really appreciate it!&lt;/p&gt;

&lt;p&gt;I was able to replicate this. It appears to happen regardless of the presence of indexes on any of these fields (and regardless of if they&apos;re created before or after the query). This also appears to affect some rapid releases like 6.3.0+ and possibly others.&lt;/p&gt;
&lt;div class=&apos;table-wrap&apos;&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;th class=&apos;confluenceTh&apos;&gt;Version&lt;/th&gt;
&lt;th class=&apos;confluenceTh&apos;&gt;Single Query&lt;/th&gt;
&lt;th class=&apos;confluenceTh&apos;&gt;$or Query (first execution)&lt;/th&gt;
&lt;th class=&apos;confluenceTh&apos;&gt;$or Query (subsequent executions)&lt;/th&gt;
&lt;th class=&apos;confluenceTh&apos;&gt;subsequent $or Query with indexes (made before or after the query)&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;5.0.23&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&#160;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;6.0.0&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&#160;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;6.0.12&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&#160;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;6.1.0&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&#160;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;6.2.0&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&#160;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;6.2.1&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&#160;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;6.3.0&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/error.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; (returns nothing)&#160;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/error.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; (returns nothing)&#160;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;6.3.1&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/error.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; (returns nothing)&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/error.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; (returns nothing)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;7.0.0&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/error.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; (returns nothing)&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/error.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; (returns nothing)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;7.0.4&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/check.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/error.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; (returns nothing)&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/error.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; (returns nothing)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;


&lt;p&gt;I&apos;ll pass this to the relevant team to take a further look. Thank you again!&lt;/p&gt;</comment>
                            <comment id="5965227" author="haser@videmo.de" created="Thu, 21 Dec 2023 09:47:39 +0000"  >&lt;p&gt;Something breaks in the collection here. The first &quot;$or&quot; query is working, but as soon as the first &quot;broken&quot; query occurs every following $or-Query is broken. Even if all documents of the collection are deleted.... It can only be fixed with restarting the mongodb or dropping the collection. Afterwards it again works for 1 request and breaks afterwards.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10520">
                    <name>Problem/Incident</name>
                                            <outwardlinks description="causes">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2542200">SERVER-84728</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="500669" name="SERVER-84338-repro-2.js" size="6334" author="ian.boros@mongodb.com" created="Wed, 3 Jan 2024 19:06:03 +0000"/>
                            <attachment id="500065" name="SERVER-84338-repro.js" size="2301" author="kyle.suarez@mongodb.com" created="Fri, 29 Dec 2023 19:14:23 +0000"/>
                            <attachment id="499094" name="index.mjs" size="670" author="mika.fischer@zoopnet.de" created="Thu, 21 Dec 2023 11:47:58 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>13.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25126"><![CDATA[Query Optimization]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="26553"><![CDATA[v7.2]]></customfieldvalue>
    <customfieldvalue key="25578"><![CDATA[v7.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 Dec 2023 09:47:39 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 weeks 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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></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>maria.prinus@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            3 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>162.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>ben.shteinfeld@mongodb.com</customfieldvalue>
            <customfieldvalue>chris.kelly@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>ian.boros@mongodb.com</customfieldvalue>
            <customfieldvalue>mika.fischer@zoopnet.de</customfieldvalue>
            <customfieldvalue>haser@videmo.de</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i35gxz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i2n82s:</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_22250" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Special Downgrade Instructions Required</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="23343"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="7264">QE 2023-12-25</customfieldvalue>
    <customfieldvalue id="8044">QO 2024-01-08</customfieldvalue>
    <customfieldvalue id="8112">QO 2024-01-22</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;// This is the original reproduction steps provided by the customer.&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;import { MongoClient, UUID } from &quot;mongodb&quot;;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;const client = await MongoClient.connect(&quot;mongodb://localhost:27017/&quot;);&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;const db = client.db(&quot;test&quot;);&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;const coll = db.collection(&quot;test&quot;);&lt;/tt&gt;&lt;tt&gt;for (let i = 0; i &amp;lt; 10; i++) {&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; const _id = new UUID();&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; const foo = new UUID();&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; await coll.insertOne({ _id, foo });&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; const query = { _id, foo };&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; const singleResult = await coll.findOne(query);&lt;/tt&gt;&lt;br/&gt;
{{&#160; const orResult = await coll.findOne(&lt;/p&gt;
{ $or: [query, query] }
&lt;p&gt;);}}&lt;br/&gt;
&lt;tt&gt;&#160; const broken = !singleResult || !orResult;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; console.log(&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; &#160; `${i&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; &#160; &#160; .toFixed()&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; &#160; &#160; .padStart(3)} single=${!&lt;span class=&quot;error&quot;&gt;Unable to render embedded object: File (singleResult} or=${) not found.&lt;/span&gt;!orResult} broken=${broken}`&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; );&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;}&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;await db.dropDatabase();&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;await client.close();&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;-------------------------------------------&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;With MongoDB 7.04&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;node .\index.mjs&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 0 single=true or=true broken=false&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 1 single=true or=false broken=true&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 2 single=true or=false broken=true&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 3 single=true or=false broken=true&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 4 single=true or=false broken=true&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 5 single=true or=false broken=true&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 6 single=true or=false broken=true&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 7 single=true or=false broken=true&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 8 single=true or=false broken=true&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 9 single=true or=false broken=true&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;-------------------------------------------&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;With MongoDB 6.0.12&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;&#160;node .\index.mjs&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 0 single=true or=true broken=false&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 1 single=true or=true broken=false&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 2 single=true or=true broken=false&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 3 single=true or=true broken=false&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 4 single=true or=true broken=false&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 5 single=true or=true broken=false&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 6 single=true or=true broken=false&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 7 single=true or=true broken=false&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 8 single=true or=true broken=false&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 9 single=true or=true broken=false&lt;/tt&gt;&lt;/p&gt;</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>
                                    <customfieldvalue><![CDATA[chris.kelly@mongodb.com]]></customfieldvalue>
    

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

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