<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:54:17 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-1307] Query operate issue</title>
                <link>https://jira.mongodb.org/browse/JAVA-1307</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I use Mongodb 2.6.1.&lt;br/&gt;
 Reproduce steps:&lt;br/&gt;
  1. used Mongdb command &lt;tt&gt;db.test.insert({item:&apos;a&apos;,qty:12})&lt;/tt&gt; to create a document.&lt;br/&gt;
  2. use command `db.test.aggregate({$match:{qty:12}})` to query document, the result is:&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;{ &quot;_id&quot; : ObjectId(&quot;53b9fcd6a50ca592c6e34b34&quot;), &quot;item&quot; : &quot;a&quot;, &quot;qty&quot; : 12 }&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;  3. use java api function &#8220;dbCollection.aggregate(args&#8230;)&#8221; to query document, the result is &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;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;53b9fcd6a50ca592c6e34b34&quot;} , &quot;item&quot; : &quot;a&quot; , &quot;qty&quot; : 12.0}&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;As the result from step 2 and step 3, the field &lt;tt&gt;&quot;qty&quot;&lt;/tt&gt; value is different. &lt;br/&gt;
The java api result should not have &quot;&lt;tt&gt;.0&lt;/tt&gt;&quot;.&lt;/p&gt;
</description>
                <environment></environment>
        <key id="145660">JAVA-1307</key>
            <summary>Query operate issue</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="9">Done</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="Rambo">Dong [X]</reporter>
                        <labels>
                    </labels>
                <created>Mon, 7 Jul 2014 02:03:58 +0000</created>
                <updated>Mon, 7 Jul 2014 10:54:49 +0000</updated>
                            <resolved>Mon, 7 Jul 2014 10:54:49 +0000</resolved>
                                    <version>2.12.1</version>
                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="650187" author="ross@10gen.com" created="Mon, 7 Jul 2014 10:54:49 +0000"  >&lt;p&gt;Hi Dong,&lt;/p&gt;

&lt;p&gt;The Java driver is correct and returning a &lt;tt&gt;Double&lt;/tt&gt; value for &lt;tt&gt;qty&lt;/tt&gt; as that is how it was originally stored.  The confusion is caused by how the mongo shell represents numbers.  If you specifically need an Integer then in the shell you need to use &lt;tt&gt;NumberInt(12)&lt;/tt&gt;.  &lt;/p&gt;

&lt;p&gt;See the &lt;a href=&quot;http://docs.mongodb.org/manual/core/shell-types/#numberint&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;shell types documentation&lt;/a&gt; for more information.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="649880" author="rambo" created="Mon, 7 Jul 2014 02:05:37 +0000"  >&lt;p&gt;Java driver 2.12.2 also have this issue.&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|hs0a1r:</customfieldvalue>

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