<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:43:49 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-2899] And/or concatenation is not respected in Aggregate and Match</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2899</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;I use match to compare if any of the &lt;b&gt;req&lt;/b&gt; are equal to one &lt;b&gt;User.AdUserTypeId&lt;/b&gt;&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: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var&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; req = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&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;[] { 1 };&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;&amp;nbsp;&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: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var&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; x = _context.Users.Aggregate()&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;				.Match(c =&amp;gt; (req.Length &amp;gt; 0 &amp;amp;&amp;amp; req[0] == c.AdUserTypeId) ||&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;							(req.Length &amp;gt; 1 &amp;amp;&amp;amp; req[1] == c.AdUserTypeId));&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;&amp;nbsp;&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: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var&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; users = x.ToList();&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;If the req length &lt;b&gt;is &amp;gt; 1&lt;/b&gt; everything works as expected.&lt;br/&gt;
 If the req length &lt;b&gt;is &amp;lt;= 1&lt;/b&gt; (as shown in the example) the following exception is thrown:&lt;/p&gt;
&lt;div class=&quot;panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;Exception&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;panelContent&quot;&gt;
&lt;p&gt;System.IndexOutOfRangeException&lt;br/&gt;
 HResult=0x80131508&lt;br/&gt;
 Message=Index was outside the bounds of the array.&lt;br/&gt;
 Source=System.Private.CoreLib&lt;br/&gt;
 StackTrace:&lt;br/&gt;
 at System.Array.InternalGetReference(Void* elemRef, Int32 rank, Int32* pIndices)&lt;br/&gt;
 at System.Array.GetValue(Int32 index)&lt;br/&gt;
 at MongoDB.Driver.Linq.Processors.PartialEvaluator.ReflectionEvaluator.VisitBinary(BinaryExpression node)&lt;br/&gt;
 at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)&lt;br/&gt;
 at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)&lt;br/&gt;
 at System.Linq.Expressions.ExpressionVisitor.VisitUnary(UnaryExpression node)&lt;br/&gt;
 at System.Linq.Expressions.UnaryExpression.Accept(ExpressionVisitor visitor)&lt;br/&gt;
 at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)&lt;br/&gt;
 at MongoDB.Driver.Linq.Processors.PartialEvaluator.ReflectionEvaluator.Evaluate(Expression node)&lt;br/&gt;
 at MongoDB.Driver.Linq.Processors.PartialEvaluator.EvaluateSubtree(Expression subtree)&lt;br/&gt;
 at MongoDB.Driver.Linq.Processors.PartialEvaluator.Visit(Expression node)&lt;br/&gt;
 at System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node)&lt;br/&gt;
 at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)&lt;br/&gt;
 at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)&lt;br/&gt;
 at MongoDB.Driver.Linq.Processors.PartialEvaluator.Visit(Expression node)&lt;br/&gt;
 at System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node)&lt;br/&gt;
 at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)&lt;br/&gt;
 at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)&lt;br/&gt;
 at MongoDB.Driver.Linq.Processors.PartialEvaluator.Visit(Expression node)&lt;br/&gt;
 at System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression node)&lt;br/&gt;
 at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)&lt;br/&gt;
 at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)&lt;br/&gt;
 at MongoDB.Driver.Linq.Processors.PartialEvaluator.Visit(Expression node)&lt;br/&gt;
 at MongoDB.Driver.Linq.Processors.PartialEvaluator.Evaluate(Expression node)&lt;br/&gt;
 at MongoDB.Driver.Linq.Translators.PredicateTranslator.Translate&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(Expression`1 predicate, IBsonSerializer`1 parameterSerializer, IBsonSerializerRegistry serializerRegistry)&lt;br/&gt;
 at MongoDB.Driver.ExpressionFilterDefinition`1.Render(IBsonSerializer`1 documentSerializer, IBsonSerializerRegistry serializerRegistry)&lt;br/&gt;
 at MongoDB.Driver.PipelineStageDefinitionBuilder.&amp;lt;&amp;gt;c_&lt;em&gt;DisplayClass27_0`1.&amp;lt;Match&amp;gt;b&lt;/em&gt;_0(IBsonSerializer`1 s, IBsonSerializerRegistry sr)&lt;br/&gt;
 at MongoDB.Driver.DelegatedPipelineStageDefinition`2.Render(IBsonSerializer`1 inputSerializer, IBsonSerializerRegistry serializerRegistry)&lt;br/&gt;
 at MongoDB.Driver.AppendedStagePipelineDefinition`3.Render(IBsonSerializer`1 inputSerializer, IBsonSerializerRegistry serializerRegistry)&lt;br/&gt;
 at MongoDB.Driver.MongoCollectionImpl`1.Aggregate&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(IClientSessionHandle session, PipelineDefinition`2 pipeline, AggregateOptions options, CancellationToken cancellationToken)&lt;br/&gt;
 at MongoDB.Driver.MongoCollectionImpl`1.&amp;lt;&amp;gt;c_&lt;em&gt;DisplayClass19_0`1.&amp;lt;Aggregate&amp;gt;b&lt;/em&gt;_0(IClientSessionHandle session)&lt;br/&gt;
 at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSession&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(Func`2 func, CancellationToken cancellationToken)&lt;br/&gt;
 at MongoDB.Driver.MongoCollectionImpl`1.Aggregate&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(PipelineDefinition`2 pipeline, AggregateOptions options, CancellationToken cancellationToken)&lt;br/&gt;
 at MongoDB.Driver.CollectionAggregateFluent`2.ToCursor(CancellationToken cancellationToken)&lt;br/&gt;
 at MongoDB.Driver.IAsyncCursorSourceExtensions.ToList&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(IAsyncCursorSource`1 source, CancellationToken cancellationToken)&lt;br/&gt;
 at QueryTester.QueryTest.QueryTest1() in C:\xxxxx\QueryTester\QueryTest.cs:line 53&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;In my opinion this should not happen because the first&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;req.Length &amp;gt; 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;prevents the second from being executed.&lt;/p&gt;</description>
                <environment>Visual Studio 2019.4.2</environment>
        <key id="1096986">CSHARP-2899</key>
            <summary>And/or concatenation is not respected in Aggregate and Match</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13202">Works as Designed</resolution>
                                        <assignee username="dmitry.lukyanov@mongodb.com">Dmitry Lukyanov</assignee>
                                    <reporter username="klaus.pruenster@gmail.com">Klaus Pr&#252;nster</reporter>
                        <labels>
                    </labels>
                <created>Wed, 15 Jan 2020 16:23:20 +0000</created>
                <updated>Fri, 27 Oct 2023 13:24:53 +0000</updated>
                            <resolved>Wed, 29 Jan 2020 18:02:26 +0000</resolved>
                                    <version>2.10.0</version>
                                                    <component>Linq</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="2772458" author="klaus.pruenster@gmail.com" created="Thu, 30 Jan 2020 10:29:39 +0000"  >&lt;p&gt;Ok, that&apos;s a pity. I found a work around:&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: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var&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; x = _context.Users.Aggregate().Match(Builders&amp;lt;User&amp;gt;.Filter.In(d =&amp;gt; d.AdUserTypeId, filter.Select(c =&amp;gt; (&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;int&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;?)c)))&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                            <comment id="2770973" author="dmitry.lukyanov" created="Wed, 29 Jan 2020 18:02:26 +0000"  >&lt;p&gt;Hello Klaus Pr&#252;nster,&lt;/p&gt;

&lt;p&gt;our LINQ implementation doesn&apos;t support this type of query analysis. That&apos;s why the right branch of binary expression(&lt;em&gt;req&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt; == c.AdUserTypeId&lt;/em&gt;) doesn&apos;t know anything about the left branch(&lt;em&gt;req.Length &amp;gt; 1&lt;/em&gt;) and then will be used in generating a mongo query that will fail because your local array doesn&apos;t have the second item.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hw6ahz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>