<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 22:03:42 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-1722] How to set &#8220;contentType&#8221; field in GridFS?</title>
                <link>https://jira.mongodb.org/browse/CXX-1722</link>
                <project id="11980" key="CXX">C++ Driver</project>
                    <description>&lt;p&gt;I&apos;m writing a RESTful call to save JPEG files in my MongoDB instance. I would like to set the field&#160;&lt;tt&gt;contentType&lt;/tt&gt;&#160;in the document when I upload to the&#160;&lt;tt&gt;fs.files&lt;/tt&gt;&#160;collection. However I don&apos;t see a way to set that field even after checking the&#160;&lt;a href=&quot;http://mongocxx.org/api/current/classmongocxx_1_1gridfs_1_1uploader.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;uploader&lt;/a&gt;&#160;and&#160;&lt;a href=&quot;http://mongocxx.org/api/current/classmongocxx_1_1gridfs_1_1bucket.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;bucket&lt;/a&gt;&#160;classes.&lt;/p&gt;

&lt;p&gt;How do I set the&#160;&lt;tt&gt;contentType&lt;/tt&gt;&#160;field in the in a document in&#160;&lt;tt&gt;fs.files&lt;/tt&gt;&#160;?&lt;br/&gt;
&#160;&lt;/p&gt;</description>
                <environment>Linux OS (RHEL), mongocxx driver 3.4, and C++ 11.</environment>
        <key id="680539">CXX-1722</key>
            <summary>How to set &#8220;contentType&#8221; field 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="13202">Works as Designed</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="betty.leung@interpreta.com">Betty Leung</reporter>
                        <labels>
                    </labels>
                <created>Wed, 30 Jan 2019 21:05:37 +0000</created>
                <updated>Fri, 27 Oct 2023 13:13:38 +0000</updated>
                            <resolved>Fri, 1 Feb 2019 00:50:17 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="2133622" author="betty.leung@interpreta.com" created="Thu, 31 Jan 2019 17:34:42 +0000"  >&lt;p&gt;Thank you for the info Kevin.&lt;/p&gt;</comment>
                            <comment id="2132900" author="kevin.albertson" created="Thu, 31 Jan 2019 01:38:45 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=betty.leung%40interpreta.com&quot; class=&quot;user-hover&quot; rel=&quot;betty.leung@interpreta.com&quot;&gt;betty.leung@interpreta.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;The GridFS specification deprecated the &lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/gridfs/gridfs-spec.rst#file-upload&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;contentType option&lt;/a&gt; with the &lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/gridfs/gridfs-spec.rst#design-rationale&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;rationale being&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Why is contentType deprecated?&lt;br/&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 mongocxx::options::gridfs::upload options do not include the deprecated contentType, but do include the metadata option.&lt;/p&gt;

&lt;p&gt;Best,&lt;br/&gt;
Kevin&lt;/p&gt;</comment>
                            <comment id="2132720" author="betty.leung@interpreta.com" created="Wed, 30 Jan 2019 22:29:25 +0000"  >&lt;p&gt;This is the field I am trying to set:&lt;br/&gt;
&lt;a href=&quot;https://docs.mongodb.com/v3.2/core/gridfs/#files.contentType&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/v3.2/core/gridfs/#files.contentType&lt;/a&gt;&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|huaken:</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>