<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:44:56 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-3298] PipelineDefinitionBuilder.Match() method generates incorrect BsonDocument for equality filter</title>
                <link>https://jira.mongodb.org/browse/CSHARP-3298</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;I have the following code:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;PipelineDefinitionBuilder.Match&amp;lt;BsonDocument, BsonDocument&amp;gt;(myPipeline, Builders&amp;lt;BsonDocument&amp;gt;.Filter.Eq(&quot;$_id&quot;, &quot;$$userId&quot;));&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;I expect the generated BsonDocument to be:&lt;/p&gt;

&lt;p&gt;{{&lt;/p&gt;
{ &quot;$eq&quot;: [&quot;$_id&quot;, &quot;$$userId&quot;] }
&lt;p&gt;}}&lt;/p&gt;

&lt;p&gt;Instead I get this:&lt;/p&gt;

&lt;p&gt;{{&lt;/p&gt;
{ &quot;$_id&quot;: &quot;$$userId&quot; }
&lt;p&gt;}}&lt;/p&gt;

&lt;p&gt;Which results in the aggregation command to fail with error:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;Command aggregate failed: unknown top level operator: $_id&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;Other filters seems to work as expected. e.g&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;PipelineDefinitionBuilder.Match&amp;lt;BsonDocument, BsonDocument&amp;gt;(myPipeline, Builders&amp;lt;BsonDocument&amp;gt;.Filter.Gt(&quot;$var1&quot;, &quot;$$var2&quot;));&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;Generates:&lt;/p&gt;

&lt;p&gt;{{&lt;/p&gt;
{ &quot;$gt&quot;: [&quot;$var1&quot;, &quot;$$var2&quot;]&#160;}
&lt;p&gt;}}&lt;/p&gt;</description>
                <environment>Windows/ASP.NET Core 3</environment>
        <key id="1579459">CSHARP-3298</key>
            <summary>PipelineDefinitionBuilder.Match() method generates incorrect BsonDocument for equality filter</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="marwan@aouida.com">Marwan Aouida</reporter>
                        <labels>
                    </labels>
                <created>Sat, 2 Jan 2021 20:14:49 +0000</created>
                <updated>Fri, 27 Oct 2023 13:24:47 +0000</updated>
                            <resolved>Thu, 7 Jan 2021 19:27:16 +0000</resolved>
                                    <version>2.11.5</version>
                                                    <component>BSON</component>
                    <component>Builders</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3553317" author="dmitry.lukyanov" created="Thu, 7 Jan 2021 18:51:18 +0000"  >&lt;p&gt;Hello &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=marwan%40aouida.com&quot; class=&quot;user-hover&quot; rel=&quot;marwan@aouida.com&quot;&gt;marwan@aouida.com&lt;/a&gt; ,&lt;/p&gt;

&lt;p&gt;The issue is related to the fact that you use $_&lt;em&gt;id&lt;/em&gt; with a dollar sign. This syntax for referencing fields is not valid in this context. The right form should be with simple _&lt;em&gt;id&lt;/em&gt; key.&lt;/p&gt;

&lt;p&gt;Also, you cannot use variable with &lt;em&gt;$$&lt;/em&gt; in such context, this method allows using only constants in &lt;em&gt;TField&lt;/em&gt; value.&lt;/p&gt;

&lt;p&gt;So, this query will work:&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;PipelineDefinitionBuilder.Match&amp;lt;BsonDocument, &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;BsonDocument&amp;gt;(myPipeline, &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;Builders&amp;lt;BsonDocument&amp;gt;.Filter.Eq(&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;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;/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;</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|hy9i27:</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>