<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:24:56 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>[SERVER-11118] Add dateToString aggregation operator</title>
                <link>https://jira.mongodb.org/browse/SERVER-11118</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Implement a $dateToString aggregation operator.&lt;/p&gt;

&lt;p&gt;e.g. : $dateToString: &lt;/p&gt;
{format: &quot;&amp;lt;format string&amp;gt;&quot;, date: &quot;&amp;lt;$field&amp;gt;&quot;}
&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Modifiers should be mostly similar to strftime, but with the addition of milliseconds.&lt;/p&gt;

&lt;p&gt;All units should be zero-padded to the maximum number of digits for that unit.&lt;/p&gt;

&lt;p&gt;--------&lt;br/&gt;
I&apos;d like to propose an aggregation operator that supports formatting date objects as strings (using the strftime function).&lt;/p&gt;

&lt;p&gt;This comes very handy when working with time-series data.&lt;/p&gt;

&lt;p&gt;For example: if you want to aggregate documents by a specific hour, you&apos;d have to do this: {$group: {_id: {year: {$year: &apos;$date&apos;}, month: {$month: &apos;$date&apos;}, day: &lt;/p&gt;
{&apos;$dayOfMonth&apos;: &apos;$date&apos;}
&lt;p&gt;, hour: {$hour: &apos;$date&apos;}}}}&lt;/p&gt;

&lt;p&gt;Here&apos;s how you can do it with dateFormat: {$group: {_id: {$dateFormat: &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;$date&amp;#39;, &amp;#39;%Y-%m-%d %H&amp;#39;&amp;#93;&lt;/span&gt;}}}&lt;/p&gt;

&lt;p&gt;In addition to the shorter syntax, the results look much nicer (-:&lt;/p&gt;

&lt;p&gt;I&apos;ve already implemented the feature and the tests (I&apos;ll add a link after the ticket is created).&lt;/p&gt;

&lt;p&gt;This is my first contribution to the MongoDB server code. I&apos;ll open a pull request referencing this issue. Please tell me if I&apos;m doing anything wrong.&lt;/p&gt;</description>
                <environment></environment>
        <key id="93612">SERVER-11118</key>
            <summary>Add dateToString aggregation operator</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="adam.midvidy">Adam Midvidy</assignee>
                                    <reporter username="alonho">Alon Horev</reporter>
                        <labels>
                            <label>community-team</label>
                    </labels>
                <created>Thu, 10 Oct 2013 09:22:15 +0000</created>
                <updated>Fri, 8 May 2015 17:02:36 +0000</updated>
                            <resolved>Thu, 24 Jul 2014 16:06:00 +0000</resolved>
                                                    <fixVersion>2.7.4</fixVersion>
                                    <component>Aggregation Framework</component>
                                        <votes>4</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="735740" author="xgen-internal-githook" created="Tue, 7 Oct 2014 17:59:38 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;TylerBrock&apos;, u&apos;name&apos;: u&apos;Tyler Brock&apos;, u&apos;email&apos;: u&apos;tyler.brock@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-11118&quot; title=&quot;Add dateToString aggregation operator&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-11118&quot;&gt;&lt;del&gt;SERVER-11118&lt;/del&gt;&lt;/a&gt; add additional $dateToString aggregation tests&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/59deabf9a55140fa502e637058983d67118e3722&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/59deabf9a55140fa502e637058983d67118e3722&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="670323" author="xgen-internal-githook" created="Thu, 24 Jul 2014 18:01:06 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;amidvidy&apos;, u&apos;name&apos;: u&apos;Adam Midvidy&apos;, u&apos;email&apos;: u&apos;amidvidy@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-11118&quot; title=&quot;Add dateToString aggregation operator&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-11118&quot;&gt;&lt;del&gt;SERVER-11118&lt;/del&gt;&lt;/a&gt; expect new uassert codes in dateToString jstest&lt;/p&gt;

&lt;p&gt;Signed-off-by: Eric Milkie &amp;lt;milkie@10gen.com&amp;gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/b92932d2c00795932014dcc500d7ec45181c7c82&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/b92932d2c00795932014dcc500d7ec45181c7c82&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="670203" author="xgen-internal-githook" created="Thu, 24 Jul 2014 16:41:57 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;kaloianm&apos;, u&apos;name&apos;: u&apos;Kaloian Manassiev&apos;, u&apos;email&apos;: u&apos;kaloian.manassiev@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-11118&quot; title=&quot;Add dateToString aggregation operator&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-11118&quot;&gt;&lt;del&gt;SERVER-11118&lt;/del&gt;&lt;/a&gt; Fix duplicate uassert ids&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/23007a0af84a44080336bc02d17e8cf4b009b1e2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/23007a0af84a44080336bc02d17e8cf4b009b1e2&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="670138" author="xgen-internal-githook" created="Thu, 24 Jul 2014 16:04:58 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;amidvidy&apos;, u&apos;name&apos;: u&apos;Adam Midvidy&apos;, u&apos;email&apos;: u&apos;amidvidy@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-11118&quot; title=&quot;Add dateToString aggregation operator&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-11118&quot;&gt;&lt;del&gt;SERVER-11118&lt;/del&gt;&lt;/a&gt; add dateToString aggregation operator&lt;/p&gt;

&lt;p&gt;Signed-off-by: Matt Kangas &amp;lt;matt.kangas@mongodb.com&amp;gt;&lt;br/&gt;
Closes #720&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/308af33f76d1e15c105f04ea762f8951b47c5168&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/308af33f76d1e15c105f04ea762f8951b47c5168&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="440038" author="asya" created="Sat, 12 Oct 2013 01:22:02 +0000"  >&lt;p&gt;While translating date to string is useful, I think truncating to certain time resolution is a useful functionality by itself - plus it would allow hourly aggregations while maintaining the correct type.  Currently it&apos;s possible by using date math and subtracting appropriate number of milliseconds from date to truncate it down to an hour (or any preferred) resolution...&lt;/p&gt;

&lt;p&gt;Maybe that&apos;s a separate operator request though - but it seems like a better method to get to hourly granularity of time than turning into a string.&lt;/p&gt;</comment>
                            <comment id="439020" author="alonho" created="Thu, 10 Oct 2013 17:29:55 +0000"  >&lt;p&gt;Perhaps boost&apos;s implementation of date_time is portable enough: &lt;a href=&quot;http://www.boost.org/doc/libs/1_54_0/doc/html/date_time/date_time_io.html#date_time.format_flags&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.boost.org/doc/libs/1_54_0/doc/html/date_time/date_time_io.html#date_time.format_flags&lt;/a&gt;&lt;br/&gt;
It also support milliseconds.&lt;/p&gt;</comment>
                            <comment id="439005" author="redbeard0531" created="Thu, 10 Oct 2013 17:13:35 +0000"  >&lt;p&gt;One thing to consider is that strftime is full of system-specific extensions which makes it hard to offer as our interface. Additionally none of the system implementations of strftime include milliseconds although ours would have to since BSON Dates have ms resolution. We will probably have to do a from-scratch implementation of strftime-like functionality after deciding on our desired spec to do this properly.&lt;/p&gt;</comment>
                            <comment id="438748" author="alonho" created="Thu, 10 Oct 2013 09:23:32 +0000"  >&lt;p&gt;Pull request: &lt;a href=&quot;https://github.com/alonho/mongo/tree/SERVER-11118&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/alonho/mongo/tree/SERVER-11118&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="88051">SERVER-10651</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="56773">SERVER-7695</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="74715">SERVER-9626</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="149189">DOCS-3823</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10220">
                    <name>Tested</name>
                                            <outwardlinks description="tested by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <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_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 10 Oct 2013 17:06:53 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 19 weeks, 1 day ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></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_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 19 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>adam.midvidy</customfieldvalue>
            <customfieldvalue>alonho</customfieldvalue>
            <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>mathias@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrmck7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrg2jr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7274</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="209">Server 2.7.4</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_10166" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Tests Written</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10154"><![CDATA[Complete]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrj5xb:</customfieldvalue>

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