<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:55:41 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-1859] Improve explanation of MongoCollection type parameter</title>
                <link>https://jira.mongodb.org/browse/JAVA-1859</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;MongoCollection&amp;lt;Document&amp;gt; doesn&apos;t make sense to me. This is much harder to use in code than just MongoCollection. Why was it genericized? What else can you have a collection of besides documents? This seems like potentially it wasn&apos;t the best way to design this. Or maybe it&apos;s just that the documentation needs to be improved to make it clearer what the purpose of this is.&lt;/p&gt;</description>
                <environment></environment>
        <key id="209930">JAVA-1859</key>
            <summary>Improve explanation of MongoCollection type parameter</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="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="chengas123">Ben McCann</reporter>
                        <labels>
                    </labels>
                <created>Thu, 11 Jun 2015 05:39:39 +0000</created>
                <updated>Wed, 7 Oct 2015 13:01:03 +0000</updated>
                            <resolved>Fri, 4 Sep 2015 13:18:16 +0000</resolved>
                                                    <fixVersion>3.1.0</fixVersion>
                                    <component>API</component>
                    <component>Documentation</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="1053718" author="jeff.yemin" created="Wed, 7 Oct 2015 13:01:03 +0000"  >&lt;p&gt;Released in &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/releases/tag/r3.1.0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;3.1.0&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1022485" author="ross@10gen.com" created="Fri, 4 Sep 2015 13:18:16 +0000"  >&lt;p&gt;Updated the API docs for MongoCollection - thanks to Ben for the impetus.&lt;/p&gt;</comment>
                            <comment id="1022483" author="xgen-internal-githook" created="Fri, 4 Sep 2015 13:17:05 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;rozza&apos;, u&apos;name&apos;: u&apos;Ross Lawley&apos;, u&apos;email&apos;: u&apos;ross.lawley@gmail.com&apos;}
&lt;p&gt;Message: Api Docs clarify the connection between MongoCollection and the CodecRegistry&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1859&quot; title=&quot;Improve explanation of MongoCollection type parameter&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-1859&quot;&gt;&lt;del&gt;JAVA-1859&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/a92afc8eae8a476516ea659aaa59ecd5a0c1064d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/a92afc8eae8a476516ea659aaa59ecd5a0c1064d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="937689" author="chengas123" created="Thu, 11 Jun 2015 14:48:17 +0000"  >&lt;p&gt;Thanks. That&apos;s very helpful.&lt;/p&gt;

&lt;p&gt;I&apos;ll leave this open for now with a couple suggestions of changes I think could be helpful newbies to the API like me to navigate the docs and figure this out.&lt;/p&gt;

&lt;p&gt;It&apos;d be helpful to expand the documentation TDocument from &quot;The type that this collection will encode documents from and decode documents to.&quot; to something more like &quot;The type that this collection will encode documents from and decode documents to. These must first be registered with a CodecRegistry. The default CodecRegistry includes built-in support for types like Document, DBObject, POJO. See &lt;a href=&quot;http://mongodb.github.io/mongo-java-driver/3.0/bson/codecs/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://mongodb.github.io/mongo-java-driver/3.0/bson/codecs/&lt;/a&gt; for details&quot;&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;http://mongodb.github.io/mongo-java-driver/3.0/bson/codecs/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;CodecRegistry docs&lt;/a&gt; show you how to create a registry, but not how you can use it for anything. I see now that there&apos;s a section in the &lt;a href=&quot;http://mongodb.github.io/mongo-java-driver/3.0/driver/reference/crud/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;CRUD docs&lt;/a&gt; for that explains it. However, when I wanted to see what CodecRegistry did I went to the CodecRegistry docs and so I never saw that. These need to be linked somehow. My suggestion would be to move most of that documentation from CRUD to CodecRegistry and then in CRUD say something like &quot;An overload of the getCollection method allows clients to specify a different class for representing BSON documents. For example, users of the legacy CRUD API from the 2.x driver series may wish to continue using BasicDBObject in order to ease the transition to the new CRUD API. For more details see the &amp;lt;a href=&quot;...&quot;&amp;gt;Codec documentation&amp;lt;/a&amp;gt;.&quot;&lt;/p&gt;

&lt;p&gt;(btw, the blog post you linked me to suggests leaving feedback in the bug tracker. if you prefer the mailing list for this sort of feedback it might be worth updating that)&lt;/p&gt;

&lt;p&gt;thanks!&lt;/p&gt;</comment>
                            <comment id="937481" author="ross@10gen.com" created="Thu, 11 Jun 2015 10:30:53 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=chengas123&quot; class=&quot;user-hover&quot; rel=&quot;chengas123&quot;&gt;chengas123&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;This might have been better posted on the &lt;a href=&quot;https://groups.google.com/group/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mailing list&lt;/a&gt; as the JAVA project is specifically for driver based bugs or issues.&lt;/p&gt;

&lt;p&gt;I&apos;m interested in why you find it much harder to use - can you provide an example?  We&apos;ve kept with a default &lt;tt&gt;Document&lt;/tt&gt; type via the API, so it shouldn&apos;t be intrusive but we have allowed users who want to use their own domain objects the ability to do so directly, which wasn&apos;t possible in 2.0.&lt;/p&gt;

&lt;p&gt;There is a blog post about some of the specific design decisions in the 3.0 driver on the MongoDB blog: &lt;a href=&quot;https://www.mongodb.com/blog/post/introducing-30-java-driver&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Introducing the 3.0 Java Driver&lt;/a&gt; which talks briefly about the new codecs and generics features:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A popular feature request has been to provide an easier way to convert the results from the database straight into domain objects. With the introduction of a Codec registry and the use of generics in the API, working directly with domain objects is now possible. So if the new Document class isn&apos;t to your taste, then register a custom codec for your domain object and simply use the API and pass in the class of the domain object you want to use.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;This is also mentioned in the driver documentation in the &lt;a href=&quot;http://mongodb.github.io/mongo-java-driver/3.0/driver/reference/crud/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;CRUD operations guide&lt;/a&gt;.  This is particularly helpful when migrating legacy &lt;tt&gt;DBObject&lt;/tt&gt; code to the new API as you can simply do: &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;MongoCollection&amp;lt;DBObject&amp;gt; collection = client.getDatabase(&quot;myDatabase&quot;).getCollection(&quot;collectionName&quot;, DBObject.class);&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;The forthcoming PojoCodec in the 3.1 release (&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1833&quot; title=&quot;Create basic PojoCodec&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-1833&quot;&gt;&lt;del&gt;JAVA-1833&lt;/del&gt;&lt;/a&gt;) will help with the usability of Codecs and using custom Domain Objects to represent data from MongoDB.  Of course examples of using this feature will be added to the documentation as well.&lt;/p&gt;

&lt;p&gt;I hope this answers your questions.&lt;/p&gt;

&lt;p&gt;Ross&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|hreatb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="588">Java Sprint 24</customfieldvalue>
    <customfieldvalue id="712">Java Sprint 25</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>