<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:38:00 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-847] Linq provider needs to support non-constant boolean expressions</title>
                <link>https://jira.mongodb.org/browse/CSHARP-847</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;In the older Samus C# driver supported having non-constant boolean expression in the LINQ query.  For example this is a valid expression in the Samus driver...&lt;/p&gt;

&lt;p&gt;//Get the first post having mismatched character count of its body length....&lt;br/&gt;
var post = collection.Linq().First(x =&amp;gt; x.CharCount != x.Body.Length);&lt;/p&gt;

&lt;p&gt;However in the official driver this is an invalid expression and throws an ArgumentException...&lt;/p&gt;

&lt;p&gt;//Get the first post having mismatched character count of its body length....&lt;br/&gt;
 var post = collection.AsQueryable().First(x =&amp;gt; x.CharCount != x.Body.Length);&lt;/p&gt;

&lt;p&gt;In his response, Craig G. Wilson indicates that the Samus driver is transforming the binary expression of a LINQ call into a MapReduce.  It would seem that this is what the official driver should do as well.  The official driver seems limiting and non-intuitive if it is going to allow LINQ queries. It clearly should support the complete complement of possible binary expressions not just a constant r-expression of a binary expression.&lt;/p&gt;

&lt;p&gt;Here&apos;s a link to the question on the mongo-charp forum ...&lt;br/&gt;
&lt;a href=&quot;https://groups.google.com/forum/#!topic/mongodb-csharp/XAz-TiCctqE&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/#!topic/mongodb-csharp/XAz-TiCctqE&lt;/a&gt;&lt;/p&gt;
</description>
                <environment></environment>
        <key id="95006">CSHARP-847</key>
            <summary>Linq provider needs to support non-constant boolean expressions</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="cwaldron">Chris Waldron</reporter>
                        <labels>
                            <label>driver</label>
                    </labels>
                <created>Mon, 21 Oct 2013 01:59:15 +0000</created>
                <updated>Fri, 17 Apr 2015 21:45:14 +0000</updated>
                            <resolved>Fri, 17 Apr 2015 21:45:14 +0000</resolved>
                                    <version>1.8.3</version>
                                                    <component>Linq</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="891966" author="craiggwilson" created="Fri, 17 Apr 2015 21:45:14 +0000"  >&lt;p&gt;We aren&apos;t going to fix this until the server updates the query language.&lt;/p&gt;</comment>
                            <comment id="446664" author="rstam" created="Fri, 25 Oct 2013 14:21:09 +0000"  >&lt;p&gt;Looking more closely at your example &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-7623&quot; title=&quot;comparison operation right hand side should be expressions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-7623&quot;&gt;&lt;del&gt;SERVER-7623&lt;/del&gt;&lt;/a&gt; may or may not provide the needed support, because the right hand side of your comparison is not another field, but rather a computed value (the length of another field).&lt;/p&gt;

&lt;p&gt;If you wanted to write this query against the current version of the server there are easier ways than using map/reduce or the aggregation framework. The simplest solution is to use a JavaScript where clause. For example, using the MongoDB shell:&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;&amp;gt; db.test.find()&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;{ &quot;_id&quot; : ObjectId(&quot;526a7aa77013202f0052f532&quot;), &quot;CharCount&quot; : 1, &quot;Body&quot; : &quot;a&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;{ &quot;_id&quot; : ObjectId(&quot;526a7aa77013202f0052f533&quot;), &quot;CharCount&quot; : 1, &quot;Body&quot; : &quot;ab&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;&amp;gt; db.test.find({$where:&quot;this.CharCount != this.Body.length&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;{ &quot;_id&quot; : ObjectId(&quot;526a7aa77013202f0052f533&quot;), &quot;CharCount&quot; : 1, &quot;Body&quot; : &quot;ab&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;   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;&amp;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;You would write this in C# like this:&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;var query = Query.Where(&quot;this.CharCount != this.Body.length&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;foreach (var document in collection.Find(query))&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;{&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;    Console.WriteLine(document.ToJson());&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;The MongoDB LINQ provider also lets you &quot;inject&quot; low level queries into a LINQ query, so you could also write this using LINQ like this:&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;var post = collection.AsQueryable&amp;lt;BsonDocument&amp;gt;().First(x =&amp;gt; Query.Where(&quot;this.CharCount != this.Body.length&quot;).Inject());&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;Keep in mind that Javascript where clauses have more overhead than primitive queries, because 1. they can&apos;t use indexes and 2. they incur the overhead of translating each possible matching document to a Javascript document and executing the Javascript where clause.&lt;/p&gt;</comment>
                            <comment id="446445" author="cwaldron" created="Thu, 24 Oct 2013 23:00:06 +0000"  >&lt;p&gt;Also I&apos;m surprised that I&apos;m the first to report this because I only encountered this issue because of your article on CodeProject using the Samus driver and trying to port your example to the official driver.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br/&gt;
Chris.&lt;/p&gt;
</comment>
                            <comment id="446442" author="cwaldron" created="Thu, 24 Oct 2013 22:56:06 +0000"  >&lt;p&gt;Thanks Craig.  This had a lot to do with silencing the critics.  I&apos;ll use the aggregation example should the need arise.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br/&gt;
Chris.&lt;/p&gt;
</comment>
                            <comment id="446407" author="craiggwilson" created="Thu, 24 Oct 2013 21:54:47 +0000"  >&lt;p&gt;You&apos;re right. It might be a blocker for some people.  However, the simple statement is that the Server does not support this yet.  Until it does, it doesn&apos;t make sense for the driver to support it.  We are most definitely not going to work around it using the agg framework or map/reduce because each of those alternatives (for this purpose) will provide a very sub-par experience with regards to performance. All I can ask you to do is vote for the Server ticket and wait.  I guarantee that when that gets done, we&apos;ll be supporting it as well.&lt;/p&gt;

&lt;p&gt;That being said, regardless of the common-place of this particular requirement in SQL, you are the first to report this issue (probably not the first to encounter it).  Additionally, in my experience of building apps using mongodb, I haven&apos;t needed this feature.  In fact, a lot of devs have built a whole lot of applications without this particular feature. It&apos;s kind of a chicken-and-egg problem, asking if you can do something without knowing if you actually need it. Of course, if you do need it and didn&apos;t ask, then darn it.&lt;/p&gt;

&lt;p&gt;For now, we&apos;ll leave this ticket open and when the server team implements theirs, we&apos;ll implement this one.  I hope that is satisfactory.&lt;/p&gt;</comment>
                            <comment id="446400" author="cwaldron" created="Thu, 24 Oct 2013 21:42:06 +0000"  >&lt;p&gt;Craig,&lt;/p&gt;

&lt;p&gt;    Being new to Mongo, I&apos;m not familiar with all the possible workarounds.  The aggregation example that you&apos;ve demonstrated seems to be a reasonable alternative.  My request is more about completeness of LINQ usage and familiarity coming from SQL.  In order MongoDB adoption I have to response to critics who are looking for any excuse to put up resistance.  I need to make sure that the LINQ driver can be used in a natural manner thus field comparison is going to be an issue.&lt;/p&gt;

&lt;p&gt;   Whether the CSHARP driver generate MapReduce or the aggregation is not the underlying issue for me.  That is a driver concern.  What is my main concern is the completeness of LINQ binary comparison.  Telling developers that they can&apos;t do something that is natural for them to do will be a huge roadblock for me to for MongoDB&apos;s adoption.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br/&gt;
Chris.&lt;/p&gt;

</comment>
                            <comment id="445964" author="craiggwilson" created="Thu, 24 Oct 2013 13:00:15 +0000"  >&lt;p&gt;As Robert linked, &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-7623&quot; title=&quot;comparison operation right hand side should be expressions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-7623&quot;&gt;&lt;del&gt;SERVER-7623&lt;/del&gt;&lt;/a&gt; is the ticket for the server supporting this.  Certainly comparing fields against each other would be a nice feature, but it currently isn&apos;t supported.  The .NET Driver certainly could support field comparison using MapReduce.  However, it is unlikely that we will given that MapReduce is not he best suited for live queries.  However, if you feel strongly that we should support generating to MapReduce, then please file a new CSHARP feature request ticket.&lt;/p&gt;

&lt;p&gt;There is a way you can use the aggregation framework to do this and a future update of the driver will probably support it (&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-601&quot; title=&quot;Linq to Aggregation Framework&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-601&quot;&gt;&lt;del&gt;CSHARP-601&lt;/del&gt;&lt;/a&gt;), but even then it won&apos;t look like what you are wanting.  Instead, it requires you do a projection that emits a boolean field based on the comparison of fields.&lt;/p&gt;

&lt;p&gt;So:&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;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;  $project:{ &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;    matches: { $eq:[ &apos;$field1&apos;, &apos;$field2&apos; ] }&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;  }, { &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: { matches:true }&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;  }&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;In LINQ this might look like this...&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;collection.AsQueryable&amp;lt;Entity&amp;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;  .Select(doc =&amp;gt; new { Matches = doc.Field1 == doc.Field2 })&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;  .Where(doc2 =&amp;gt; doc2.Matches)&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;  .ToList();&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;Above, we are going to compare &quot;field1&quot; and &quot;field2&quot; for equality and store the result into the newly created &quot;matches&quot; field, and then run a predicate on that document.  Not that this is going to be relatively inefficient because an index cannot be used on the &quot;matches&quot; field, and so it would be in your best interest to have prefiltered this before the $project so that this final $match is run on a small set of data.&lt;/p&gt;</comment>
                            <comment id="445865" author="cwaldron" created="Thu, 24 Oct 2013 04:35:39 +0000"  >&lt;p&gt;Robert I have a question.  Is the scenario of comparing fields one that is atypical of MongoDB users.  Comparing fields is quite common is SQL. Is this a missing feature of MongoDB or is this By Design?&lt;/p&gt;

&lt;p&gt;Could the C# Driver support field comparison using MapReduce via the parsing of the boolean expression?  It would appear that the parser could determine the type of boolean expression and based on the type of expression generate the property action.&lt;/p&gt;

&lt;p&gt;Thx,&lt;br/&gt;
Chris&lt;/p&gt;</comment>
                            <comment id="444690" author="rstam" created="Tue, 22 Oct 2013 17:02:09 +0000"  >&lt;p&gt;I would add that if the underlying MongoDB query language starts supporting comparing two fields against each other, at that point we would modify our LINQ provider to support this type of query.&lt;/p&gt;

&lt;p&gt;You can follow (and vote on) the corresponding server ticket: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-7623&quot; title=&quot;comparison operation right hand side should be expressions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-7623&quot;&gt;&lt;del&gt;SERVER-7623&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="443639" author="rstam" created="Mon, 21 Oct 2013 02:56:23 +0000"  >&lt;p&gt;A LINQ query has to be translated at runtime into an equivalent MongoDB query. We only support LINQ queries that can be translated to equivalent MongoDB queries (and more particularly: to efficient MongoDB queries, which means no JavaScript where clauses).&lt;/p&gt;

&lt;p&gt;The primary reason that the driver restricts the r-exp to constants is that the underlying MongoDB query language only allows comparing fields to constants.&lt;/p&gt;

&lt;p&gt;It is common for LINQ providers to not support every possible LINQ query that could be written. LINQ queries that have no equivalent in the underlying query language (MongoDB in our case, SQL in the case of LINQ to SQL, etc...) result in a runtime exception.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="55986">SERVER-7623</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>CSHARP-935</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrwilb:</customfieldvalue>

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