<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:57:25 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-2517] Improve documentation for deprecated GridFsFile methods</title>
                <link>https://jira.mongodb.org/browse/JAVA-2517</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;&lt;tt&gt;GridFsFile.getContentType()&lt;/tt&gt; is deprecated with a hint to use the metadata document instead. however there&apos;s no documentation which field is to be accessed to obtain the content type. Also, it looks like the method is deprecated but doesn&apos;t return the content type anymore.&lt;/p&gt;

&lt;p&gt;What&apos;s the reason for the deprecation in the first place. What&apos;s wrong with looking up the value from the new location falling back on the old one if none could be found. With the deprecation clients now all of a sudden have to have intimate knowledge about the structure of the metadata document instead of just being able to access the content type, no matter where it&apos;s coming from. That&apos;s a huge step backwards, isn&apos;t it?&lt;/p&gt;</description>
                <environment></environment>
        <key id="384633">JAVA-2517</key>
            <summary>Improve documentation for deprecated GridFsFile methods</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="13202">Works as Designed</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="oliver.gierke">Oliver Gierke</reporter>
                        <labels>
                    </labels>
                <created>Thu, 18 May 2017 07:27:28 +0000</created>
                <updated>Fri, 27 Oct 2023 13:21:13 +0000</updated>
                            <resolved>Thu, 18 May 2017 11:17:40 +0000</resolved>
                                    <version>3.4.2</version>
                                                    <component>GridFS</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1574230" author="oliver.gierke" created="Thu, 18 May 2017 10:32:38 +0000"  >&lt;p&gt;My point was: from an abstraction level point of view &lt;tt&gt;getContentType()&lt;/tt&gt; was way better as it expresses what I want, not where it&apos;s actually obtained from. Now all of a sudden I need to put stuff into a &lt;tt&gt;Map&lt;/tt&gt; and pull it out of it again. It&apos;s an implementation detail now leaking into client code I.e. the abstraction level of &lt;tt&gt;GridFsFile&lt;/tt&gt; was lowered, which is completely the opposite of general design best practices.&lt;/p&gt;

&lt;p&gt;I guess it is what it is now and we&apos;re going to just populate a metadata field. Thanks for elaborating though!&lt;/p&gt;</comment>
                            <comment id="1574208" author="xgen-internal-githook" created="Thu, 18 May 2017 10:00:07 +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: Doc: clarify deprecated top level metadata should be stored in the metadata document&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2517&quot; title=&quot;Improve documentation for deprecated GridFsFile methods&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2517&quot;&gt;&lt;del&gt;JAVA-2517&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/50f46bb86720c1e12dc44ef77e2efe9e9944b05b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/50f46bb86720c1e12dc44ef77e2efe9e9944b05b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1574204" author="ross@10gen.com" created="Thu, 18 May 2017 09:48:20 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=oliver.gierke&quot; class=&quot;user-hover&quot; rel=&quot;oliver.gierke&quot;&gt;oliver.gierke&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Apologies for the confusion caused. In 3.1 we added a new implementation of &lt;tt&gt;GridFS&lt;/tt&gt; following the cross driver &lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/gridfs/gridfs-spec.rst&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;GridFS specification for GridFS&lt;/a&gt;.  Prior to this specification GridFS was a convention based upon the driver and there were differences between implementations. The new API specified that all metadata should be stored inside a sub document rather than be top level fields. However, any existing top level fields from existing GridFS data would still accessible via the new API.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;Why is contentType deprecated?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Most fields in the files collection document are directly used by the driver, with the exception of: metadata, contentType and aliases. All information that is purely for use of the application should be embedded in the &apos;metadata&apos; document. Users of GridFS who would like to store a contentType for use in their applications are encouraged to add a &apos;contentType&apos; field to the &#8216;metadata&#8217; document instead of using the deprecated top-level &#8216;contentType&#8217; field.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The argument for a separate metadata document is it&apos;s ultimately more flexible than having named specialised fields. However, we would have legacy users and data migrating to this API and they would need access to the data, hence the inclusion of deprecated methods in a new API.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What&apos;s wrong with looking up the value from the new location falling back on the old one if none could be found?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Looking at the storage code in SpringData you are using the metadata directly when storing the content type: &lt;a href=&quot;https://github.com/spring-projects/spring-data-mongodb/blob/e9da449667b466f5cb002b89a2b56bc7003e233a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsTemplate.java#L161&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;GridFsTemplate.java#L161&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;I think thats a good idea and worth doing for SpringData to fallback if the &lt;tt&gt;metadata.type&lt;/tt&gt; field does not exist you can lookup the  &lt;tt&gt;contentType&lt;/tt&gt;. It depends on your strategy for handling legacy metadata. However, as you are using alternative field names the strategy wouldn&apos;t work if it was implemented in the mongo java driver.&lt;/p&gt;

&lt;p&gt;Hope that answers your questions, I&apos;ll look to clarify the API documentation for the 3.5 release.&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|hszqxr:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>