<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51: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-165] Unnecessary calls to containsKey</title>
                <link>https://jira.mongodb.org/browse/JAVA-165</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;If there is an array of objects method objectStart() in DBCallback resets _lastArray&lt;br/&gt;
so that objectDone() of the array calls containsKey() unnecessarily.&lt;br/&gt;
Replace _lastArray with instanceOf List ?&lt;/p&gt;</description>
                <environment></environment>
        <key id="13093">JAVA-165</key>
            <summary>Unnecessary calls to containsKey</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="eliot">Eliot Horowitz</assignee>
                                    <reporter username="hmeiser">Hans Meiser</reporter>
                        <labels>
                    </labels>
                <created>Tue, 14 Sep 2010 20:57:12 +0000</created>
                <updated>Fri, 29 Oct 2010 02:48:53 +0000</updated>
                            <resolved>Thu, 28 Oct 2010 04:37:33 +0000</resolved>
                                    <version>2.1</version>
                                    <fixVersion>2.3</fixVersion>
                                    <component>Performance</component>
                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="19746" author="auto" created="Thu, 28 Oct 2010 04:37:42 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;login&apos;: &apos;erh&apos;, &apos;name&apos;: &apos;Eliot Horowitz&apos;, &apos;email&apos;: &apos;eliot@10gen.com&apos;}
&lt;p&gt;Message: fix stack handling in DBCallback &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-165&quot; title=&quot;Unnecessary calls to containsKey&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-165&quot;&gt;&lt;del&gt;JAVA-165&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://github.com/mongodb/mongo-java-driver/commit/c45fc7ec209478e72517d8b29324b44c8e25343c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo-java-driver/commit/c45fc7ec209478e72517d8b29324b44c8e25343c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="19591" author="hmeiser" created="Mon, 25 Oct 2010 07:31:32 +0000"  >&lt;p&gt;If we have&lt;/p&gt;

&lt;p&gt;a:[&lt;/p&gt;
{x:1}
&lt;p&gt;,&lt;/p&gt;
{x:2}
&lt;p&gt;]&lt;/p&gt;

&lt;p&gt;objectStart(true,&apos;a&apos;) --&amp;gt; _lastArray==true&lt;br/&gt;
objectStart(false,&apos;x&apos;) --&amp;gt; _lastArray==false&lt;br/&gt;
objectDone()&lt;br/&gt;
objectStart(false,&apos;x&apos;) --&amp;gt; _lastArray==false&lt;br/&gt;
objectDone()&lt;/p&gt;

&lt;p&gt;In the method objectDone there is a check for _lastArray==false but _lastArray is false for all documents within an array.&lt;br/&gt;
The method does unnecessary checks for $ref and $id &lt;/p&gt;

&lt;p&gt;    public Object objectDone(){&lt;br/&gt;
        BSONObject o = (BSONObject)super.objectDone();&lt;br/&gt;
        if ( ! _lastArray &amp;amp;&amp;amp;&lt;br/&gt;
             o.containsKey( &quot;$ref&quot; ) &amp;amp;&amp;amp;&lt;br/&gt;
             o.containsKey( &quot;$id&quot; ) )&lt;/p&gt;
{
            return cur().put( _lastName , new DBRef( _db, o ) );
        }

&lt;p&gt;        return o;&lt;br/&gt;
    }&lt;/p&gt;

&lt;p&gt;would become&lt;/p&gt;

&lt;p&gt;if(o instanceOf List) {&lt;br/&gt;
   if(o.containsKey( &quot;$ref&quot; ) &amp;amp;&amp;amp; o.containsKey( &quot;$id&quot; ) )&lt;br/&gt;
     return cur().put( _lastName , new DBRef( _db, o ) );&lt;br/&gt;
}&lt;/p&gt;</comment>
                            <comment id="19583" author="eliot" created="Mon, 25 Oct 2010 02:43:08 +0000"  >&lt;p&gt;Can you explain a bit more.&lt;br/&gt;
Not seing what you are.&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|hrhcvr:</customfieldvalue>

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