<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:57:38 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>[JAVA-2601] find(Filters.regex(&quot;bad field&quot;,&quot;anything&quot;)) Returns Records from Wrong Collection!!</title>
                <link>https://jira.mongodb.org/browse/JAVA-2601</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;This 3.4.5 db has a number of collections (about 10). When I query a collection by&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;mycollection.find(Filters.regex(&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;field&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: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;anything matching&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;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;against one collection, I generally get valid records from the WRONG COLLECTION if &quot;field&quot; is not actually a field of the documents in the chosen collection. If &quot;field&quot; is a valid field, or if I use eq instead of regex, this does not happen.&lt;/p&gt;

&lt;p&gt;I would expect to get no matches if &quot;field&quot; is not present in the documents in the collection referred to by &quot;mycollection&quot;.&lt;/p&gt;

&lt;p&gt;Short of adding a lot of code to verify that only &quot;field&quot; names are used that are actually in the documents, I don&apos;t see any way to fix this problem. Please help!&lt;/p&gt;


</description>
                <environment>Centos 6.8 and Java 1.8.0_66. Java driver version 3.4.2. Mongodb server version mongodb-linux-x86_64-rhel62-3.4.5. Not sure why 3.4.5 is not an option for &amp;quot;affects versions&amp;quot;.</environment>
        <key id="428381">JAVA-2601</key>
            <summary>find(Filters.regex(&quot;bad field&quot;,&quot;anything&quot;)) Returns Records from Wrong Collection!!</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="-1">Unassigned</assignee>
                                    <reporter username="jschatzman">James Schatzman</reporter>
                        <labels>
                    </labels>
                <created>Fri, 15 Sep 2017 22:50:33 +0000</created>
                <updated>Fri, 27 Oct 2023 13:21:11 +0000</updated>
                            <resolved>Wed, 20 Sep 2017 19:58:05 +0000</resolved>
                                    <version>3.4.0</version>
                                                    <component>Query Operations</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="1678065" author="jeff.yemin" created="Wed, 20 Sep 2017 19:57:54 +0000"  >&lt;p&gt;Thanks for the feedback, and glad to hear that the mystery is solved.&lt;/p&gt;</comment>
                            <comment id="1677979" author="jschatzman" created="Wed, 20 Sep 2017 18:43:33 +0000"  >&lt;p&gt;Indeed, building the 3.5.0 drivers from source worked fine, and there was no change. &lt;/p&gt;

&lt;p&gt;One comment: the website suggests that you can download the tgz or zip archive and build from there, but actually the build script fails if you do it this way. If you clone the repo, then the build script works fine.&lt;/p&gt;

&lt;p&gt;This was entirely my goof and I apologize for wasting your time. Apparently, a rogue application put some bad data in the subject Collection. When I dumped the data in the mongo command line tool (with find()), I failed to scroll down far enough to see the bad data.&lt;/p&gt;

&lt;p&gt;It turns out that the bad records had the field in my regex that I was expecting to be non-existent. Mystery solved!&lt;/p&gt;</comment>
                            <comment id="1674671" author="jeff.yemin" created="Sat, 16 Sep 2017 01:54:17 +0000"  >&lt;p&gt;See &lt;a href=&quot;http://mongodb.github.io/mongo-java-driver/3.5/driver/getting-started/installation/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://mongodb.github.io/mongo-java-driver/3.5/driver/getting-started/installation/&lt;/a&gt; for installation instructions.  If it&apos;s not clear, please let us know.&lt;/p&gt;

&lt;p&gt;I highly doubt though that this is a bug in the 3.4 driver that was fixed in 3.5.0 or a bug in the 3.4.5 server that was fixed in 3.4.9.  I&apos;d focus on collecting the requested logs.&lt;/p&gt;</comment>
                            <comment id="1674649" author="jschatzman" created="Sat, 16 Sep 2017 00:32:30 +0000"  >&lt;p&gt;I am going to try the 3.5.0 Java drivers - once I find a working version! The Maven binary repo referenced on the mongoDB website is incomplete and unusable (it is missing all the &quot;core&quot; class files). The source download does appear to be complete. I will try building from source and let you know what I find out.&lt;/p&gt;

&lt;p&gt;If that doesn&apos;t change anything, then I will try using the 3.4.9 server.&lt;/p&gt;

&lt;p&gt;Once I figure out how to turn on logging I will post the requested data.&lt;/p&gt;</comment>
                            <comment id="1674623" author="jeff.yemin" created="Fri, 15 Sep 2017 22:58:19 +0000"  >&lt;p&gt;I&apos;ve never seen anything like this.  To figure out what&apos;s going on please attach mongodb server logs at a high enough verbosity that the queries appear in the logs, and indicate the relevant log lines.&lt;/p&gt;

&lt;p&gt;Please also supply the name of the collection that the application is querying against, and if possible the collection from which it appears to be returning documents.&lt;/p&gt;

&lt;p&gt;If you can supply a reproducible test case, all the better.&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|ht6t8f:</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>