<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:07:29 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-4965] $not appears to distribute incorrectly over conjunctions</title>
                <link>https://jira.mongodb.org/browse/SERVER-4965</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The $not operator appears to incorrectly distribute over (implicit) conjunctions of operators like $in, $gt, etc.&lt;br/&gt;
It appears to treat &quot;not(p and q)&quot; as &quot;not(p) and not(q)&quot; instead of &quot;not(p) or not(q)&quot;.&lt;br/&gt;
This has only been tested on db versions 2.0.0 and 2.0.3-rc0.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;p&gt;// insert some data&lt;br/&gt;
db.test.insert(&lt;/p&gt;
{a:1}
&lt;p&gt;)&lt;br/&gt;
db.test.insert(&lt;/p&gt;
{a:3}
&lt;p&gt;)&lt;/p&gt;

&lt;p&gt;// Example 1&lt;br/&gt;
// not(a &amp;gt; 2 and a &amp;lt; 4)&lt;br/&gt;
// a &amp;lt;= 2 or a &amp;gt;= 4&lt;br/&gt;
// should yield the row with a = 1&lt;br/&gt;
// instead it yields no rows, appearing to do:&lt;br/&gt;
// a &amp;lt;= 2 and a &amp;gt;= 4&lt;br/&gt;
db.test.find({a:{$not:{$gt:2, $lt:4}}})&lt;/p&gt;

&lt;p&gt;// Example 2&lt;br/&gt;
// not(a &amp;lt; 2 and a &amp;gt; 4) &lt;br/&gt;
// a &amp;gt;= 2 or a &amp;lt;= 4&lt;br/&gt;
// should yield both rows (a = 1 and a = 3)&lt;br/&gt;
// instead it yields only a = 3, appearing to incorrectly distribute &quot;$not&quot; over the implicit conjunction to get:&lt;br/&gt;
// a &amp;gt;= 2 and a &amp;lt;= 4&lt;br/&gt;
db.test.find({a:{$not:{$lt:2, $gt:4}}})&lt;/p&gt;


</description>
                <environment></environment>
        <key id="30620">SERVER-4965</key>
            <summary>$not appears to distribute incorrectly over conjunctions</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="-1">Unassigned</assignee>
                                    <reporter username="jramish">John R</reporter>
                        <labels>
                    </labels>
                <created>Tue, 14 Feb 2012 20:45:41 +0000</created>
                <updated>Wed, 29 Feb 2012 03:53:45 +0000</updated>
                            <resolved>Tue, 14 Feb 2012 21:08:19 +0000</resolved>
                                    <version>2.0.0</version>
                    <version>2.0.3</version>
                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="88436" author="aaron" created="Tue, 14 Feb 2012 22:53:24 +0000"  >&lt;p&gt;Also, feel free to file a new ticket requesting different behavior for $not.&lt;/p&gt;</comment>
                            <comment id="88431" author="aaron" created="Tue, 14 Feb 2012 22:50:54 +0000"  >&lt;p&gt;Yep, I already filed &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-128&quot; title=&quot;Document the behavior of $not applied to a subdocument containing multiple operators&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-128&quot;&gt;&lt;del&gt;DOCS-128&lt;/del&gt;&lt;/a&gt; to improve the documentation.&lt;/p&gt;

&lt;p&gt;Btw, you can use $nor to get behavior similar to what you&apos;re looking for: {$nor:&lt;span class=&quot;error&quot;&gt;&amp;#91;{a:{$gt:2,$lt:4}}&amp;#93;&lt;/span&gt;}&lt;/p&gt;</comment>
                            <comment id="88409" author="jramish" created="Tue, 14 Feb 2012 21:43:56 +0000"  >&lt;p&gt;It seems that many users would expect the query&lt;br/&gt;
	db.test.find({a:{$not:{$gt:2, $lt:4}}})&lt;br/&gt;
to yield those documents that do not appear in the query&lt;br/&gt;
	db.test.find({a:{$gt:2, $lt:4}})&lt;br/&gt;
as per ordinary logic / De Morgan&apos;s laws and the behavior of analogous expressions in SQL and other languages.&lt;br/&gt;
That behavior would certainly be useful in the case of a conjunction of operators.&lt;br/&gt;
I&apos;m not sure in what situations it is useful to treat &quot;not(p and q)&quot; as &quot;not(p) and not(q)&quot;, but if that usage makes sense, then it would certainly be helpful for it to be documented.&lt;/p&gt;</comment>
                            <comment id="88388" author="aaron" created="Tue, 14 Feb 2012 21:08:09 +0000"  >&lt;p&gt;This is the behavior that was designed for $not.  $not is a meta operator - it just reverses the matching behavior of the operators in a sub object.  It does not reverse the matching behavior of a conjunction of operators in a subobject.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="30627">DOCS-128</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 14 Feb 2012 21:08:09 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 1 week, 1 day 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_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>ian@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            12 years, 1 week, 1 day 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_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>aaron</customfieldvalue>
            <customfieldvalue>jramish</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrodf3:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>23513</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|ht0cgf:</customfieldvalue>

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