<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:23:32 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-30359] Add a more generalized $hash expression</title>
                <link>https://jira.mongodb.org/browse/SERVER-30359</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;We added $toHashedIndexKey in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-49214&quot; title=&quot;Add $toHashedIndexKey expression&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-49214&quot;&gt;&lt;del&gt;SERVER-49214&lt;/del&gt;&lt;/a&gt; which solves some similar use cases, and some described below in the original description and comments. This ticket remains open to add a more general hash expression - perhaps for more cryptographic use cases, or if someone wants/needs a particular algorithm.&lt;/p&gt;
&lt;h3&gt;&lt;a name=&quot;OriginalDescription&quot;&gt;&lt;/a&gt;Original Description&lt;/h3&gt;

&lt;p&gt;Oracle has &lt;a href=&quot;http://docs.oracle.com/database/121/SQLRF/functions183.htm#SQLRF55647&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.oracle.com/database/121/SQLRF/functions183.htm#SQLRF55647&lt;/a&gt; which computes one of several standard hash functions on a particular column.&lt;/p&gt;

&lt;p&gt;It would be nice if there was analogous expression in agg:&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;hashMD5:{$hash:{source:&quot;$expression&quot;, function:&quot;MD5&quot;}}&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;or something like that.&lt;/p&gt;</description>
                <environment></environment>
        <key id="408822">SERVER-30359</key>
            <summary>Add a more generalized $hash expression</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-query-optimization">Backlog - Query Optimization</assignee>
                                    <reporter username="asya.kamsky@mongodb.com">Asya Kamsky</reporter>
                        <labels>
                            <label>BIC</label>
                            <label>expression</label>
                            <label>pm1457-nominee</label>
                    </labels>
                <created>Wed, 26 Jul 2017 21:34:18 +0000</created>
                <updated>Wed, 29 Nov 2023 22:34:11 +0000</updated>
                                                                            <component>Aggregation Framework</component>
                                        <votes>16</votes>
                                    <watches>23</watches>
                                                                                                                <comments>
                            <comment id="5914097" author="JIRAUSER1272935" created="Wed, 29 Nov 2023 22:34:11 +0000"  >&lt;p&gt;I am not very familiar with the server internals, but I think the difference between obtaining the hash of a document&apos;s raw bson vs a document&apos;s field is that the former would hash the bytes before they are marshaled into a C++ bson struct. The latter would hash a specific field of the already-marshaled C++ bson struct at which point we may no longer have access to the raw bson bytes.&lt;/p&gt;

&lt;p&gt;I would like a hash of the raw bson bytes. This hash would be used as the checksum for a document. The server already provides a dbHash function that returns the MD5 checksums of each collection within a database, I would like a hash function that returns the MD5 checksum of a document. More specifically, I will use this function to get the individual MD5 of each document within a collection.&lt;/p&gt;</comment>
                            <comment id="5913730" author="asya" created="Wed, 29 Nov 2023 20:34:26 +0000"  >&lt;p&gt;Is there a difference since a fiend can be a subdocument aka object?&lt;/p&gt;</comment>
                            <comment id="5913644" author="JIRAUSER1272935" created="Wed, 29 Nov 2023 20:03:30 +0000"  >&lt;p&gt;Is the ask of this ticket strictly related to obtaining arbitrary $hash of certain fields or does it also encompass the md5 hash of the raw bson of a document?&lt;/p&gt;</comment>
                            <comment id="4249370" author="alexhelkar@gmail.com" created="Wed, 15 Dec 2021 12:53:00 +0000"  >&lt;p&gt;That&apos;d a great feature if added. Currently, also working on a case where I would really appreciate a $hash projection of a compound $group key.&#160;&lt;/p&gt;</comment>
                            <comment id="2400875" author="christian.kurze" created="Fri, 30 Aug 2019 06:38:07 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=asya&quot; class=&quot;user-hover&quot; rel=&quot;asya&quot;&gt;asya&lt;/a&gt; Yes, technically speaking they are different. Semantically, they are the same. Can we use all the expressions of $project/$addFields? Then the different objects can be transformed in the correct same structure.&lt;/p&gt;</comment>
                            <comment id="2400854" author="asya" created="Fri, 30 Aug 2019 06:01:42 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=christian.kurze&quot; class=&quot;user-hover&quot; rel=&quot;christian.kurze&quot;&gt;christian.kurze&lt;/a&gt; but {a:1,b:2} and {b:2,a:1} don&apos;t compare as equal as sub-objects, why would you expect them to get the same hash?&lt;/p&gt;</comment>
                            <comment id="2395111" author="christian.kurze" created="Wed, 28 Aug 2019 08:34:17 +0000"  >&lt;p&gt;This will also help in creating hashes to identify changed data (i.e. hash the values of a (sub)document and identify if it has changed) - needed for use cases where we want to store the history and not compare documents in the application (which is expensive to transfer data to the application and requires a lot of application code).&lt;/p&gt;

&lt;p&gt;We need to be careful in case of subdocuments so that &lt;/p&gt;
{ a: 1, b: 2 }
&lt;p&gt; gets the same hash as as &lt;/p&gt;
{ b:2, a: 1}
&lt;p&gt;. The expression provided as &quot;source&quot; attribute can take care of proper ordering or creating a concatenated string for the use case of keeping historic data and versions.&lt;/p&gt;</comment>
                            <comment id="2125595" author="contact@aetium.com" created="Thu, 24 Jan 2019 11:16:55 +0000"  >&lt;p&gt;This is a feature I really need at the moment, in an aggregation pipe I use a computed key as a $group _id, and the key could be very long, a hash would fix that.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                            <comment id="2044359" author="asya" created="Sun, 28 Oct 2018 17:53:28 +0000"  >&lt;p&gt;I don&apos;t see a reason not to allow that, in fact, that was one of the asks by someone who basically wanted to hash full document content and then store result in the document (so later it can be tested if the document content has been changed at all).&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2044197" author="patrick.meredith" created="Sat, 27 Oct 2018 17:43:45 +0000"  >&lt;p&gt;Also, do we expect to be able to hash arrays and subdocuments? I&apos;m going to go ahead and do it that way.&lt;/p&gt;</comment>
                            <comment id="2038485" author="patrick.meredith" created="Mon, 22 Oct 2018 22:41:12 +0000"  >&lt;p&gt;Expected algorithms are SHA1, SHA256, SHA384, SHA512, and MD5, any others?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2121617">SERVER-69128</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1396326">SERVER-49214</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>11.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_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25126"><![CDATA[Query Optimization]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[5002K00000nC0eZQAS]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 22 Oct 2018 22:41:12 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        10 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/WRITING-6106'>WRITING-6106</a></s>]]></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>craven.huynh@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            10 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-query-optimization</customfieldvalue>
            <customfieldvalue>christian.kurze@mongodb.com</customfieldvalue>
            <customfieldvalue>craven.huynh@mongodb.com</customfieldvalue>
            <customfieldvalue>alexhelkar@gmail.com</customfieldvalue>
            <customfieldvalue>patrick.meredith@mongodb.com</customfieldvalue>
            <customfieldvalue>contact@aetium.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htbq27:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr2cgv:</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_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="2882">Query 2019-08-12</customfieldvalue>

                        </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|htbc4v:</customfieldvalue>

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