<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:55:02 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-1608] Unable to query data after writing to DB in java</title>
                <link>https://jira.mongodb.org/browse/JAVA-1608</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I am using java to write to a MongoDB the following way: &lt;br/&gt;
(java code):&lt;br/&gt;
MongoClient mongo = new MongoClient(&quot;localhost&quot;, 27017);	&lt;br/&gt;
DB db = mongo.getDB(&quot;testdb&quot;);&lt;br/&gt;
DBCollection table = db.getCollection(&quot;myCollection&quot;);&lt;br/&gt;
BasicDBObject document = new BasicDBObject();&lt;/p&gt;

&lt;p&gt;document.put(&quot;someKey&quot;, someValue); &lt;br/&gt;
...&lt;br/&gt;
table.insert(document);&lt;/p&gt;

&lt;p&gt;It writes to the DB fine, however I am UNABLE TO QUERY out the results.&lt;br/&gt;
The only way i can query the results is by going into mongo and running the following command:&lt;/p&gt;

&lt;p&gt;db.myCollection.find().forEach(printjson);&lt;/p&gt;

&lt;p&gt;The command above will show ALL the results for that particular table in JSON format (As its expected), however if run the following command: &lt;/p&gt;

&lt;p&gt;db.myCollection.find(&lt;/p&gt;
{someKey : &quot;someValue&quot;}
&lt;p&gt;, {_id: 0, someKey : 1}); &lt;/p&gt;

&lt;p&gt;I get no results, or at least none written from my Java code, if I write entries any other way, they do query out normally.&lt;/p&gt;

&lt;p&gt;I am wondering if this is a common problem, and if there&apos;s a work around for it.&lt;/p&gt;

&lt;p&gt;Note: I also noticed that the entries written from my Java code are indented a little further than the entries NOT written from the Java code.&lt;/p&gt;</description>
                <environment>Eclipse (Windows)&lt;br/&gt;
</environment>
        <key id="177062">JAVA-1608</key>
            <summary>Unable to query data after writing to DB in java</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="-1">Unassigned</assignee>
                                    <reporter username="cjrodriguez1">Carlos</reporter>
                        <labels>
                    </labels>
                <created>Mon, 5 Jan 2015 22:28:01 +0000</created>
                <updated>Wed, 11 Sep 2019 19:11:27 +0000</updated>
                            <resolved>Mon, 5 Jan 2015 23:11:18 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="797618" author="jeff.yemin" created="Mon, 5 Jan 2015 23:11:10 +0000"  >&lt;p&gt;It&apos;s hard to tell what you are doing wrong without more details, but the place to collection that is on the mongodb-user Google group or Stack Overflow.  Can you post your question there, and include some more specific information including the actual query that you are running, and a sample document from the collection that you think should be included in the results?&lt;/p&gt;


&lt;p&gt;Regards,&lt;br/&gt;
Jeff&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|hs56u7:</customfieldvalue>

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