<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:56: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>[SERVER-1367] create an $eq operator for queries that works similar to $gte and $lte</title>
                <link>https://jira.mongodb.org/browse/SERVER-1367</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;We are writing a simple ORM for python called maroon.  (&lt;a href=&quot;http://github.com/nod/maroon&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/nod/maroon&lt;/a&gt;)  Our library builds mongo queries dynamically from python code that looks like this:&lt;br/&gt;
results = Things.find((j==3)&amp;amp;(k&amp;gt;10))&lt;/p&gt;

&lt;p&gt;Right now we have to treat equality as a special case when we do ands and ors:&lt;br/&gt;
db.things.find({j: 3, k: {$gt: 10} });&lt;/p&gt;

&lt;p&gt;It it would make our code simpler and more consistent if $eq was an operator. For example:&lt;br/&gt;
db.things.find({j: {$eq: 3}, k: {$gt: 10} });&lt;/p&gt;</description>
                <environment></environment>
        <key id="12355">SERVER-1367</key>
            <summary>create an $eq operator for queries that works similar to $gte and $lte</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="eliot">Eliot Horowitz</assignee>
                                    <reporter username="jeffamcgee">Jeff McGee</reporter>
                        <labels>
                    </labels>
                <created>Tue, 6 Jul 2010 15:02:34 +0000</created>
                <updated>Fri, 19 Dec 2014 21:22:24 +0000</updated>
                            <resolved>Mon, 20 May 2013 01:20:03 +0000</resolved>
                                                    <fixVersion>2.5.0</fixVersion>
                                    <component>Querying</component>
                                        <votes>9</votes>
                                    <watches>10</watches>
                                                                                                                <comments>
                            <comment id="450607" author="mitar" created="Sun, 3 Nov 2013 07:35:18 +0000"  >&lt;p&gt;Isn&apos;t a workaround for this simply { x : &lt;/p&gt;
{ $in: [user_obj] }
&lt;p&gt; } ?&lt;/p&gt;</comment>
                            <comment id="336116" author="remonvv" created="Wed, 15 May 2013 12:20:07 +0000"  >&lt;p&gt;+1. I actually think David&apos;s motivation is the most important one.&lt;/p&gt;</comment>
                            <comment id="319149" author="glasser" created="Mon, 22 Apr 2013 23:07:31 +0000"  >&lt;p&gt;There&apos;s also a security implication here. Let&apos;s say you&apos;re writing a JSON-based API, that takes an untrusted user input, and you want to do a query to find the document in the Foo collection whose bar field equals the user&apos;s object.  So you write `Foo.find(&lt;/p&gt;
{&quot;bar&quot;: userProvidedObject}
&lt;p&gt;)`.   Except... if the user-provided object has `$` keys (or is a regexp if that&apos;s possible in your RPC system, etc), you&apos;ve now allowed an arbitrary query instead of just an equality lookup?&lt;/p&gt;

&lt;p&gt;Yes, you can validate first that `userProvidedObject` is a string, but what if you really do want to allow equality checks for non-scalar fields?  If there was an `$eq` operator, then you would be able to write `Foo.find({&quot;bar&quot;: {$eq: userProvidedObject}})`, and there would be no way for the untrusted user to perform an arbitrary non-equality query.  But without this, you have to try to write your own code to check that `userProvidedObject` is not a Mongo query, which is an easy place to make mistakes.&lt;/p&gt;

&lt;p&gt;It&apos;s analogous to how while it&apos;s fine to write `printf(&quot;Foo&quot;)`, you typically want to avoid writing `printf(someString)` and want `printf(&quot;%s&quot;, someString)` instead. I don&apos;t mind that Mongo &lt;b&gt;allows&lt;/b&gt; the current syntax for equality checks, but it would be nice to have a way to write your code such that you can explicitly say &quot;I want to do an equality check against this field, please don&apos;t try to interpret this data as anything more complex than equality&quot;.&lt;/p&gt;

&lt;p&gt;BTW, this overlaps a bit with this section from the FAQ: &lt;a href=&quot;http://docs.mongodb.org/manual/faq/developers/#dollar-sign-operator-escaping&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/manual/faq/developers/#dollar-sign-operator-escaping&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This statement in the FAQ  under Querying seems to just be wrong: &quot;Generally this is not a problem for queries that resemble &lt;/p&gt;
{ x : user_obj }
&lt;p&gt;: dollar signs are not top level and have no effect&quot;, since dollar signs in the keys of user_object have effect!&lt;/p&gt;</comment>
                            <comment id="175228" author="russell.smith@ukd1.co.uk" created="Tue, 16 Oct 2012 03:19:04 +0000"  >&lt;p&gt;I just ran in to this when helping someone on the mailing lists - $all with a single element array seems to be the nicest way of doing this, though it&apos;s not entirely obvious&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;MongoDB shell version: 2.2.0&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;connecting to: test&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.drop()&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;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;&amp;gt; db.test.insert({test:[[1,2,3],[4,5,6]]})&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({test: 6})&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({&apos;test&apos;: {$elemMatch: {$all: [6]}}})&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;507cd0ae6aba85033831ba8e&quot;), &quot;test&quot; : [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] }&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({&apos;test&apos;: {$elemMatch: {$gte: 6, $lte: 6}}})&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;{ &quot;_id&quot; : ObjectId(&quot;507cd0ae6aba85033831ba8e&quot;), &quot;test&quot; : [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] }&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;$eq would do the same as either $gte + $lte or the same as $all with a single array element.&lt;/p&gt;</comment>
                            <comment id="45527" author="giver" created="Mon, 1 Aug 2011 09:04:49 +0000"  >&lt;p&gt;But it only affects only parsing of query, optimizer runs after it. my patch just simplifies {$eq: x } to x. Why query optimizer will not work?&lt;/p&gt;</comment>
                            <comment id="44431" author="eliot" created="Tue, 26 Jul 2011 04:55:58 +0000"  >&lt;p&gt;@giver - thanks for the patch.  That doesn&apos;t work for the query optimizer, so isn&apos;t mergable in that form.  &lt;/p&gt;</comment>
                            <comment id="44258" author="giver" created="Mon, 25 Jul 2011 10:36:14 +0000"  >&lt;p&gt;I have created patch fixing this issue!&lt;/p&gt;</comment>
                            <comment id="22951" author="mwaschkowski" created="Tue, 1 Feb 2011 17:55:48 +0000"  >&lt;p&gt;running into same issue with java&lt;/p&gt;</comment>
                            <comment id="22785" author="dvv" created="Fri, 28 Jan 2011 19:02:56 +0000"  >&lt;p&gt;+1 &amp;#8211; this would ease things and allow for more robust query composition.&lt;/p&gt;

&lt;p&gt;Also I don&apos;t get RegExp speciality &amp;#8211; .find(&lt;/p&gt;
{foo: /bar/}
&lt;p&gt;) but .find({foo:{$not:/bar/}}) instead of more rational imho .find({foo:{$ne:/bar/}})&lt;/p&gt;

&lt;p&gt;Please, consider .find({foo:{$ne:/bar/}}) be not throwing but instead internally converted to corresponding $not&lt;/p&gt;

&lt;p&gt;TIA,&lt;br/&gt;
--Vladimir&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="43914">SERVER-6400</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="168508">DOCS-4346</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="153832">SERVER-14973</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10220">
                    <name>Tested</name>
                                            <outwardlinks description="tested by">
                                        <issuelink>
            <issuekey id="171205">SERVER-16317</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="12415" name="mongo-eq-1.8.2.patch" size="1465" author="giver" created="Mon, 25 Jul 2011 10:36:14 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 28 Jan 2011 19:02:56 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        10 years, 15 weeks, 3 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/SERVER-6400'>SERVER-6400</a></s>]]></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_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>kay.kim@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            10 years, 15 weeks, 3 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>glasser</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>giver</customfieldvalue>
            <customfieldvalue>jeffamcgee</customfieldvalue>
            <customfieldvalue>mwaschkowski</customfieldvalue>
            <customfieldvalue>mitar</customfieldvalue>
            <customfieldvalue>remonvv</customfieldvalue>
            <customfieldvalue>russell.smith@ukd1.co.uk</customfieldvalue>
            <customfieldvalue>dvv</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpk3r:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hribyv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>20587</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

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

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

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