<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51:18 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-1] all method that take a DBObject, make a version that takes a map</title>
                <link>https://jira.mongodb.org/browse/JAVA-1</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;There are many places in the Mongo Java API that use the DBObject interface as parameter or return value.  BasicDBObject is the most commonly used implementation of DBObject, which implements java.util.Map, but since none of the methods accept or return Map, we&apos;re forced to make intermediate BasicDBObject wrappers around objects that could otherwise be passed straight in.  If these methods were updated to accept/return Maps, usage could be simpler and less onerous on user code.  &lt;/p&gt;

&lt;p&gt;Below is a list of the spots in the API that could benefit (I think) from being updated:&lt;/p&gt;

&lt;p&gt;The DBObject interface could implement Map&lt;br/&gt;
BasicDBObject - constructor could accept a Map&lt;br/&gt;
DBCursor.toArray() - could return List&amp;lt;Map&amp;gt;&lt;br/&gt;
DBCursor.curr(), explain(), next() could all return Map&lt;br/&gt;
DBCollection - ensureIndex() and friends could accept Map&lt;br/&gt;
DBCollection - find() &amp;amp; findOne() could accept Map&lt;br/&gt;
DBCollection - getIndexInfo() could return List&amp;lt;Map&amp;gt;&lt;br/&gt;
DBCollection - apply(), insert(), remove(), save(), update() could all accept Map&lt;/p&gt;
</description>
                <environment></environment>
        <key id="10067">JAVA-1</key>
            <summary>all method that take a DBObject, make a version that takes a map</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="kristina">Kristina Chodorow</assignee>
                                    <reporter username="liamstask">Liam Staskawicz</reporter>
                        <labels>
                    </labels>
                <created>Fri, 17 Apr 2009 20:00:51 +0000</created>
                <updated>Tue, 15 Aug 2023 20:07:07 +0000</updated>
                            <resolved>Tue, 21 Apr 2009 13:41:36 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="10034" author="kristina" created="Tue, 21 Apr 2009 13:41:36 +0000"  >&lt;p&gt;Much better.  Added toMap on DBObject.&lt;/p&gt;</comment>
                            <comment id="10033" author="eliot" created="Tue, 21 Apr 2009 13:23:49 +0000"  >&lt;p&gt;Can you add a non-static method on DBObject&lt;/p&gt;

&lt;p&gt;public Map toMap()  &lt;/p&gt;

&lt;p&gt;then anything that implements DBObject has to implement toMap.&lt;/p&gt;

&lt;p&gt;maybe put in the docs that its an optional operation&lt;/p&gt;</comment>
                            <comment id="10032" author="kristina" created="Tue, 21 Apr 2009 13:15:31 +0000"  >&lt;p&gt;So, I can&apos;t have DBObject extend Map, unfortunately, because then BasicDBList doesn&apos;t work (it extends ArrayList and implements DBObject, and List and Map are incompatible... good job, Java Collections API!).&lt;/p&gt;

&lt;p&gt;Overloading DBCollection methods to take Maps is also problematic, as BasicDBObject extends HashMap, so if you call any of the overloaded methods with a BasicDBObject, Java complains that the method you&apos;re calling is ambiguous.&lt;/p&gt;

&lt;p&gt;However!  I&apos;ve added a constructor to BasicDBObject that takes a Map, and added a static method toMap() that takes a DBObject and returns a Map.  I also added BasicDBObjectBuilder.start(Map m).&lt;/p&gt;

&lt;p&gt;Not sure what else I can do, if anyone has any ideas, let me know.&lt;/p&gt;</comment>
                            <comment id="10024" author="liamstask" created="Fri, 17 Apr 2009 21:13:18 +0000"  >&lt;p&gt;I can live with that - even better if DBObject can extend Map in that case &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;</comment>
                            <comment id="10023" author="eliot" created="Fri, 17 Apr 2009 20:19:07 +0000"  >&lt;p&gt;we don&apos;t want the return values to be Map because that limits the implementations. &lt;br/&gt;
but we can certainly make versions that accept maps&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|hrhdtj:</customfieldvalue>

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