<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:55 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-722] Errors when DBRef&apos;s $id is Object instead of simple value</title>
                <link>https://jira.mongodb.org/browse/JAVA-722</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Mongo is able to store objects in _id field, for example: &lt;br/&gt;
db.test.save({_id: {name: &quot;Alex&quot;, email: &quot;test@example.com&quot;}});&lt;/p&gt;

&lt;p&gt;when i try to make a DBRef from another collection to this record it also works:&lt;br/&gt;
db.test2.save({_id: &quot;test2&quot;, ref: new DBRef(&quot;test&quot;, &lt;/p&gt;
{ &quot;name&quot; : &quot;Alex&quot;, &quot;email&quot; : &quot;test@example.com&quot; }
&lt;p&gt;)});&lt;br/&gt;
db.test2.findOne({_id: &quot;test2&quot;}).ref.fetch();&lt;/p&gt;

&lt;p&gt;Same stuff in Java just doesn&apos;t work:&lt;br/&gt;
DBCollection test = db.getCollection(&quot;test&quot;);&lt;br/&gt;
        DBCollection test2 = db.getCollection(&quot;test2&quot;);&lt;br/&gt;
        test.save(new BasicDBObject(&quot;_id&quot;, new BasicDBObject(&quot;name&quot;, &quot;Alex&quot;).append(&quot;email&quot;, &quot;test@example.com&quot;)));&lt;br/&gt;
        test2.save(new BasicDBObject(&quot;_id&quot;, &quot;test2&quot;).append(&quot;ref&quot;, new DBRef(db, &quot;test&quot;, new BasicDBObject(&quot;name&quot;, &quot;Alex&quot;).append(&quot;email&quot;, &quot;test@example.com&quot;))));&lt;br/&gt;
        DBObject testOne = test2.findOne(new BasicDBObject(&quot;_id&quot;, &quot;test2&quot;));&lt;br/&gt;
        System.out.println(testOne);&lt;/p&gt;

&lt;p&gt;...and we got this:&lt;br/&gt;
{ &lt;br/&gt;
   &quot;_id&quot; : &quot;test2&quot; , &lt;br/&gt;
   &quot;ref&quot; : { &lt;br/&gt;
           &quot;$ref&quot; : &quot;test&quot; , &lt;br/&gt;
           &quot;$id&quot; : &lt;/p&gt;
{ 
                  &quot;name&quot; : &quot;Alex&quot; , 
                  &quot;email&quot; : &quot;test@example.com&quot;
            }
&lt;p&gt;       } , &lt;br/&gt;
   &quot;$id&quot; : { &lt;br/&gt;
       &quot;$ref&quot; : &quot;test&quot; , &lt;br/&gt;
       &quot;$id&quot; : &lt;/p&gt;
{ 
            &quot;name&quot; : &quot;Alex&quot; , 
            &quot;email&quot; : &quot;test@example.com&quot;
        }
&lt;p&gt;     }&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;as you can see - we&apos;ve got additional field &quot;$id&quot; that is not in DB!!!&lt;br/&gt;
when we try to use DBRef&apos;s in collection - we&apos;ll get exception in java side.&lt;/p&gt;</description>
                <environment>any mongod version</environment>
        <key id="61121">JAVA-722</key>
            <summary>Errors when DBRef&apos;s $id is Object instead of simple value</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="trisha.gee@10gen.com">Trisha Gee</assignee>
                                    <reporter username="mutyonok">Oleksii Lomako</reporter>
                        <labels>
                    </labels>
                <created>Sun, 6 Jan 2013 20:40:48 +0000</created>
                <updated>Tue, 19 Mar 2013 14:48:29 +0000</updated>
                            <resolved>Thu, 24 Jan 2013 18:02:11 +0000</resolved>
                                    <version>2.10.1</version>
                                    <fixVersion>2.11.0</fixVersion>
                                    <component>API</component>
                                        <votes>1</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="248860" author="auto" created="Thu, 24 Jan 2013 18:02:15 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2013-01-24T18:01:57Z&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;}
&lt;p&gt;Message: Merge pull request #96 from mutyonok/master&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-722&quot; title=&quot;Errors when DBRef&amp;#39;s $id is Object instead of simple value&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-722&quot;&gt;&lt;del&gt;JAVA-722&lt;/del&gt;&lt;/a&gt;: Errors when DBRef&apos;s $id is Object instead of simple value&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/85fad93165ff2ed72fac25208ab78197520acb5e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/85fad93165ff2ed72fac25208ab78197520acb5e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="248859" author="auto" created="Thu, 24 Jan 2013 18:02:13 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2013-01-07T18:50:13Z&apos;, u&apos;email&apos;: u&apos;alexey.lomako@gmail.com&apos;, u&apos;name&apos;: u&apos;mutyonok&apos;}
&lt;p&gt;Message: Fixed &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-722&quot; title=&quot;Errors when DBRef&amp;#39;s $id is Object instead of simple value&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-722&quot;&gt;&lt;del&gt;JAVA-722&lt;/del&gt;&lt;/a&gt; bug, added test cases&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/ed480ceede5f82e8f4ed635a5a8a3251fd8716a3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/ed480ceede5f82e8f4ed635a5a8a3251fd8716a3&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="246954" author="jeff.yemin" created="Tue, 22 Jan 2013 21:49:17 +0000"  >&lt;p&gt;Just waiting for a response to comments on the pull request: &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/pull/96&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/pull/96&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="236309" author="chengas123" created="Thu, 10 Jan 2013 17:16:13 +0000"  >&lt;p&gt;Thanks for finding this and creating a pull request. I&apos;ve been bitten by this myself.&lt;/p&gt;</comment>
                            <comment id="236143" author="jeff.yemin" created="Thu, 10 Jan 2013 15:01:11 +0000"  >&lt;p&gt;I&apos;m working on a few other things now, but don&apos;t worry, it will get in to&lt;br/&gt;
the next release.&lt;/p&gt;

</comment>
                            <comment id="236096" author="mutyonok" created="Thu, 10 Jan 2013 14:18:38 +0000"  >&lt;p&gt;Hi Jeff, &lt;/p&gt;

&lt;p&gt;Did you have time to merge my pull request?&lt;br/&gt;
It is now green in travis and java 5 friendly.&lt;/p&gt;</comment>
                            <comment id="232633" author="jeff.yemin" created="Sun, 6 Jan 2013 23:11:02 +0000"  >&lt;p&gt;A pull request would be much appreciated.  Make sure you follow the guidelines in &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/master/CONTRIBUTING.md&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/blob/master/CONTRIBUTING.md&lt;/a&gt;.  Thanks. &lt;/p&gt;</comment>
                            <comment id="232588" author="mutyonok" created="Sun, 6 Jan 2013 21:31:33 +0000"  >&lt;p&gt;I have a fix for this problem - so I can make a pull request on github and hope you can merge it and release it with the next verion of Mongo java driver as my current work really needs this fix &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;Ofcourse I know that it is possible to workaround this issue by setting my own DBCallback, but I prefer to programm without any workarounds, especially when you can easilly fix this bug.&lt;/p&gt;

&lt;p&gt;Thanks in advance!&lt;/p&gt;</comment>
                            <comment id="232583" author="mutyonok" created="Sun, 6 Jan 2013 21:25:54 +0000"  >&lt;p&gt;The problem is in DefaultDBCallback.java - this callback cannot handle compound Id in DBRef. It doesn&apos;t track names of objects when decodes them.&lt;/p&gt;

&lt;p&gt;It is very easy to fix the bug - DefaultDBCallback shoud have its own stack of decoded object names (like BasicBSONDecoder) instead of just tracking last decoded name in _lastName variable.&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|hrldlb:</customfieldvalue>

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