<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 07:39:43 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>[DOCS-880] add use case &apos;distinct&apos; to agg sql chart</title>
                <link>https://jira.mongodb.org/browse/DOCS-880</link>
                <project id="10380" key="DOCS">Documentation</project>
                    <description>&lt;p&gt;db.final.aggregate( &lt;br/&gt;
{ $group: { _id: &lt;/p&gt;
{ a: &quot;$a&quot;, b: &quot;$b&quot; }
&lt;p&gt; } }, &lt;br/&gt;
{ $group: {_id: null, count: &lt;/p&gt;
{ $sum: 1 }
&lt;p&gt; } } )&lt;/p&gt;</description>
                <environment></environment>
        <key id="59152">DOCS-880</key>
            <summary>add use case &apos;distinct&apos; to agg sql chart</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="kay.kim@mongodb.com">Kay Kim</assignee>
                                    <reporter username="kay.kim@mongodb.com">Kay Kim</reporter>
                        <labels>
                    </labels>
                <created>Wed, 12 Dec 2012 16:41:32 +0000</created>
                <updated>Fri, 14 Mar 2014 15:25:45 +0000</updated>
                            <resolved>Wed, 12 Dec 2012 19:26:18 +0000</resolved>
                                                    <fixVersion>v1.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="515912" author="kay.kim@10gen.com" created="Fri, 14 Mar 2014 04:44:38 +0000"  >&lt;p&gt;Hi Luke &amp;#8211; &lt;br/&gt;
Sorry I had misread your SQL statement. I&apos;m glad you found a solution for you.&lt;/p&gt;

&lt;p&gt;To request new features, you can open a SERVER ticket rather than a DOCs (documentation ticket).&lt;/p&gt;</comment>
                            <comment id="515887" author="lthompson" created="Fri, 14 Mar 2014 02:43:12 +0000"  >&lt;p&gt;That distinct(&apos;executor&apos;).length doesn&apos;t do what I&apos;m asking in the SELECT GROUP - it just tells me how many distinct items there are, not the count of each distinct item.&lt;/p&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;p&gt;I was looking at writing that myself, but I found someone already did it!&lt;/p&gt;

&lt;p&gt;This was what I was after:&lt;br/&gt;
&lt;a href=&quot;http://skratchdot.com/projects/mesh/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://skratchdot.com/projects/mesh/&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://github.com/skratchdot/mongodb-distinct2/blob/master/distinct2.js&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/skratchdot/mongodb-distinct2/blob/master/distinct2.js&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It would be really nice to embed that into the real shell instead of having to add it to my environment by hand. Would it be possible to raise that?&lt;/p&gt;</comment>
                            <comment id="514830" author="kay.kim@10gen.com" created="Wed, 12 Mar 2014 23:02:13 +0000"  >&lt;p&gt;Hi Luke &amp;#8211; &lt;br/&gt;
we have something similar on the SQL to Aggregation page  &lt;a href=&quot;http://docs.mongodb.org/manual/reference/sql-aggregation-comparison/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/manual/reference/sql-aggregation-comparison/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;instead of  the the SQL to MongoDB page.  Sorry for the confusion.&lt;/p&gt;

&lt;p&gt;Also, in the mongo shell, we do have a &lt;tt&gt;distinct()&lt;/tt&gt; method (&lt;a href=&quot;http://docs.mongodb.org/manual/reference/method/db.collection.distinct&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/manual/reference/method/db.collection.distinct&lt;/a&gt;) which returns an array of distinct values, so you could also do:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.task.distinct( &apos;executor&apos;).length&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Regards&lt;/p&gt;</comment>
                            <comment id="513071" author="lthompson" created="Tue, 11 Mar 2014 02:11:08 +0000"  >&lt;p&gt;Was this example removed? I was looking for it here: &lt;a href=&quot;http://docs.mongodb.org/master/reference/sql-comparison/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/master/reference/sql-comparison/&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;I was looking for a better way of doing this:&lt;br/&gt;
SELECT executor, count(executor) FROM task GROUP BY executor&lt;/p&gt;

&lt;p&gt;Which I&apos;m always implementing like this:&lt;br/&gt;
db.task.aggregate({$group: {&apos;_id&apos;:&apos;$executor&apos;, count: {$sum:1}}})&lt;/p&gt;

&lt;p&gt;Ideally the shell would support this:&lt;br/&gt;
db.task.countDistinct(&apos;executor&apos;)&lt;/p&gt;</comment>
                            <comment id="213514" author="auto" created="Wed, 12 Dec 2012 22:42:32 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2012-12-12T21:56:03Z&apos;, u&apos;email&apos;: u&apos;samk@10gen.com&apos;, u&apos;name&apos;: u&apos;Sam Kleinman&apos;}
&lt;p&gt;Message: merge: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-880&quot; title=&quot;add use case &amp;#39;distinct&amp;#39; to agg sql chart&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-880&quot;&gt;&lt;del&gt;DOCS-880&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/d82210e4f31d969a7b67e89e80c76776a5980bd8&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/d82210e4f31d969a7b67e89e80c76776a5980bd8&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="213512" author="auto" created="Wed, 12 Dec 2012 22:42:28 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2012-12-12T17:44:42Z&apos;, u&apos;email&apos;: u&apos;kay.kim@10gen.com&apos;, u&apos;name&apos;: u&apos;kay&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-880&quot; title=&quot;add use case &amp;#39;distinct&amp;#39; to agg sql chart&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-880&quot;&gt;&lt;del&gt;DOCS-880&lt;/del&gt;&lt;/a&gt; add count of distinct groupings&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/7089c0f3abc7c1d33f4809f8e0ce72e4319acc04&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/7089c0f3abc7c1d33f4809f8e0ce72e4319acc04&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 12 Dec 2012 22:42:28 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 48 weeks, 6 days 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>jess.mokrzecki@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 48 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>auto</customfieldvalue>
            <customfieldvalue>kay.kim@mongodb.com</customfieldvalue>
            <customfieldvalue>lthompson</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrs5jj:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>36618</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_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrya5r:</customfieldvalue>

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