<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:59:46 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>[CXX-620] How to set _id in gridfs and append to a file in gridfs?</title>
                <link>https://jira.mongodb.org/browse/CXX-620</link>
                <project id="11980" key="CXX">C++ Driver</project>
                    <description>&lt;p&gt;I can use gridfs to do the initial loading with storeFile function.  How can I set the _id field for future appending data to the file?&lt;/p&gt;

&lt;p&gt;I think I should use GridFileBuilder class, but I didn&apos;t find any example in the cxx driver. Can someone help provide an example?&lt;/p&gt;

&lt;p&gt;Basically, I want insert data to &lt;br/&gt;
dbname.collection_files:&lt;br/&gt;
{_id:&quot;unique_string&quot;, filename:&quot;my_file_name&quot;...}&lt;/p&gt;

&lt;p&gt;After a while, the &quot;my_file_name&quot; would have something append to the end, and I want to append the data based on &quot;unique_string&quot; to the gridfs for the same data. &lt;/p&gt;

&lt;p&gt;How can I do it?&lt;/p&gt;

&lt;p&gt;Thanks in advance!&lt;/p&gt;</description>
                <environment></environment>
        <key id="215079">CXX-620</key>
            <summary>How to set _id in gridfs and append to a file in gridfs?</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="-1">Unassigned</assignee>
                                    <reporter username="yuncong.zhang">Yuncong Zhang</reporter>
                        <labels>
                            <label>legacy-cxx</label>
                    </labels>
                <created>Mon, 6 Jul 2015 18:27:49 +0000</created>
                <updated>Wed, 11 Sep 2019 19:05:03 +0000</updated>
                            <resolved>Mon, 27 Jul 2015 15:38:35 +0000</resolved>
                                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="989524" author="samantha.ritter@10gen.com" created="Mon, 27 Jul 2015 14:01:51 +0000"  >&lt;p&gt;Hi Yuncong,&lt;/p&gt;

&lt;p&gt;Yes, it&apos;s definitely not an ideal solution.  File appending in GridFS is an often asked-for feature, but unfortunately the current GridFS spec does not allow for a safe implementation.  In the future we hope to move towards a GridFS model that can handle the sort of concurrency issues file updates introduce.&lt;/p&gt;

&lt;p&gt;I&apos;ll close this ticket then, but feel free to re-open it if you&apos;d like help finding an alternative workflow or run into any other issues.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Sam&lt;/p&gt;</comment>
                            <comment id="989518" author="yuncong.zhang" created="Mon, 27 Jul 2015 13:53:28 +0000"  >&lt;p&gt;Hi Sam,&lt;/p&gt;

&lt;p&gt;That would be too costly to perform. We will think other alternatives.&lt;/p&gt;

&lt;p&gt;Thank you.&lt;/p&gt;

&lt;p&gt;Yuncong&lt;/p&gt;</comment>
                            <comment id="989508" author="samantha.ritter@10gen.com" created="Mon, 27 Jul 2015 13:44:32 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=yuncong.zhang&quot; class=&quot;user-hover&quot; rel=&quot;yuncong.zhang&quot;&gt;yuncong.zhang&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Unfortunately there is no way to append to a file once it has been stored in GridFS.  Some other drivers may have offered this feature, but this behavior is deprecated and the CXX driver does not allow for appending to a file.&lt;/p&gt;

&lt;p&gt;If your application really needs to append to files, the workaround is to read the file out of GridFS, append to it in your application, and insert it into GridFS as a new file.  This is a slow workflow, but it will get the job done.  Please let me know if this might work for you.  If not, we can try to come up with some other workarounds that might fit your application better.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Sam&lt;/p&gt;</comment>
                            <comment id="959551" author="yuncong.zhang" created="Tue, 7 Jul 2015 15:39:05 +0000"  >&lt;p&gt;Or put it this way:&lt;/p&gt;

&lt;p&gt;Is it a bad design to append file in the gridfs? &lt;/p&gt;

&lt;p&gt;I see node driver has removed the Grid Object, link below:&lt;br/&gt;
&lt;a href=&quot;https://mongodb.github.io/node-mongodb-native/2.0/tutorials/changes-from-1.0/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://mongodb.github.io/node-mongodb-native/2.0/tutorials/changes-from-1.0/&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The grid object has been removed as it&#8217;s not widely used and offers very limited GridStore capabilities.&lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;And &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Thus w+ in 2.0 only allows for changes to the file metadata and does not allow for appending to a file avoiding the possible data corruption.&lt;/p&gt;&lt;/blockquote&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|hsb8lr:</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="632">Platform 7 08/10/15</customfieldvalue>

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