<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:56:01 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-1983] GridFSBucket cannot use a custom id</title>
                <link>https://jira.mongodb.org/browse/JAVA-1983</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;with the old GridFS api, I can use an string uuid generated from java for the file id.&lt;br/&gt;
GridFSInputFile.setId(&quot;&amp;lt;a string uuid&amp;gt;&quot;)&lt;br/&gt;
with the new GridFSBucket api, it seems that I have to use an ObjectId generated by the api.&lt;/p&gt;</description>
                <environment></environment>
        <key id="232094">JAVA-1983</key>
            <summary>GridFSBucket cannot use a custom id</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="youzai001">yuechao</reporter>
                        <labels>
                            <label>feature</label>
                    </labels>
                <created>Wed, 30 Sep 2015 00:39:47 +0000</created>
                <updated>Wed, 19 Oct 2016 14:17:34 +0000</updated>
                            <resolved>Thu, 1 Oct 2015 13:54:05 +0000</resolved>
                                    <version>3.1.0</version>
                                                    <component>GridFS</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1048562" author="ross@10gen.com" created="Thu, 1 Oct 2015 13:54:06 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=youzai001&quot; class=&quot;user-hover&quot; rel=&quot;youzai001&quot;&gt;youzai001&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thanks for the follow up, the new GridFS implementation follows 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&lt;/a&gt; .  That specification has the expectation that the &lt;b&gt;driver&lt;/b&gt; will generate the &lt;tt&gt;ObjectId&lt;/tt&gt;, as such the Java implementation does indeed work as designed. I suppose having the driver generate the &lt;tt&gt;_id&lt;/tt&gt; reduces the risk of there being a duplicate key exception compared to a user supplied &lt;tt&gt;_id&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;tt&gt;GridFSUploadOptions.metadata&lt;/tt&gt; is designed to store any associated  metadata that you require, so it looks like using that could be a good fit. Alternatively, you could store the &lt;tt&gt;file_id&lt;/tt&gt; in the associated document which may be beneficial but you would have to ensure it stays in sync with gridfs if there are an revisions. However, a unique filename might be the best solution here as the &lt;tt&gt;downloadToStreamByName&lt;/tt&gt; methods can be used to ensure you always get the latest version of a given file.&lt;/p&gt;

&lt;p&gt;I hope that gives you some reasonable options to go forward with. If after reading this you feel like not allowing user generated file ids is a mistake, then the way to get the Specification reviewed for all drivers would be by creating a ticket in the &lt;a href=&quot;https://jira.mongodb.org/browse/DRIVERS&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;DRIVERS&lt;/a&gt; project.&lt;/p&gt;

&lt;p&gt;I&apos;d be interested in your thoughts,&lt;/p&gt;

&lt;p&gt;All the best,&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="1048348" author="youzai001" created="Thu, 1 Oct 2015 07:09:10 +0000"  >&lt;p&gt;Hi Ross Lawley,&lt;/p&gt;

&lt;p&gt;But I can&apos;t use an ObjectId generated by my java code too. Can you implement this?&lt;/p&gt;

&lt;p&gt;This is usable sometimes when I  want to associate a document with a file, I can just set the file id to the document id.&lt;/p&gt;

&lt;p&gt;if not, I have to add a spare id to my document.&lt;/p&gt;</comment>
                            <comment id="1047235" author="ross@10gen.com" created="Wed, 30 Sep 2015 11:59:41 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=youzai001&quot; class=&quot;user-hover&quot; rel=&quot;youzai001&quot;&gt;youzai001&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thats correct, the new &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&lt;/a&gt; deprecated using alternative types for &lt;tt&gt;_id&lt;/tt&gt; fields.  &lt;/p&gt;

&lt;p&gt;Whilst we still support legacy &lt;tt&gt;_id&lt;/tt&gt; types via the download methods we no longer allow custom &lt;tt&gt;_id&lt;/tt&gt; types when uploading for the new API.&lt;/p&gt;

&lt;p&gt;As not adding a new but deprecated method in the new API for the upload methods was a conscious decision, I&apos;m closing this ticket as works as designed.&lt;/p&gt;

&lt;p&gt;I hope that clarifies the situation.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10011"><![CDATA[Minor Change]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <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|hrexqn:</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="742">Java Sprint 26</customfieldvalue>

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