<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:51:05 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-19476] Referenced Values</title>
                <link>https://jira.mongodb.org/browse/SERVER-19476</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Here is a crazy new feature idea that handles a very common problem when dealing with databases. It concerns when you have a field on Table A which is always meant to be synchronized with a field of a referenced object on Table B.&lt;/p&gt;

&lt;p&gt;Say you have the following tables:&lt;/p&gt;

&lt;p&gt;Person&lt;/p&gt;
{
    name: String,
    job: ObjectID
}

&lt;p&gt;Job&lt;/p&gt;
{
    title: String,
    description: String
}

&lt;p&gt;Each person object references the job that the person works. For various reasons, such as indexing, request performance, or convenience, you may actually want a copy of the persons job title on the Person object itself, like so:&lt;/p&gt;

&lt;p&gt;Person&lt;/p&gt;
{
    name: String,
    job: ObjectID,
    jobTitle: String
}

&lt;p&gt;The jobTitle field is always just copied from whatever job object is referenced. This isn&apos;t amazingly clean, and it does result in duplication of data - in the ideal world it wouldn&apos;t be necessary. But this does come up a lot in practice in real world programming.&lt;/p&gt;

&lt;p&gt;The main problem is keeping the jobTitle field up to date. Every time and place that we ever change the title field on the Job object, we have to ensure that we update every Person object which references that Job. This is a nightmare to maintain and these bugs are the bane of my existence.&lt;/p&gt;

&lt;p&gt;What I would like to see in my database is some sort of Referenced Value or Foreign Value functionality. Instead of actually setting the jobTitle to a string, I might set it to a referenced value like so:&lt;/p&gt;

&lt;p&gt;Person&lt;/p&gt;
{
    name: &quot;bob&quot;,
    job: ObjectId(55a7fd9c99d1c7a113000043),
    jobTitle: ReferencedValue(&quot;job.title&quot;)
}

&lt;p&gt;Now anytime I request a Person object, I will get the correct corresponding jobTitle which is contained within the referenced Job object. If the Job doesn&apos;t exist, jobTitle might return null. And if I change the corresponding Job object, Mongo will automatically update all Person objects which reference it to have the new title.&lt;/p&gt;

&lt;p&gt;This might not be easy to implement, but it would save developers a hell of a lot of pain from referential integrity related issues. And its in keeping with the spirit of MongoDB, which is to be a powerful, fully featured database which makes development easier by handling more of the functionality itself.&lt;/p&gt;</description>
                <environment></environment>
        <key id="217413">SERVER-19476</key>
            <summary>Referenced Values</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="3">Duplicate</resolution>
                                        <assignee username="sam.kleinman">Sam Kleinman</assignee>
                                    <reporter username="genixpro">Bradley Arsenault</reporter>
                        <labels>
                    </labels>
                <created>Fri, 17 Jul 2015 17:35:35 +0000</created>
                <updated>Sat, 9 Jul 2016 21:09:22 +0000</updated>
                            <resolved>Fri, 17 Jul 2015 21:13:06 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="969152" author="genixpro" created="Fri, 17 Jul 2015 21:38:27 +0000"  >&lt;p&gt;$lookup looks fascinating and quite useful, but doesn&apos;t cover the critical use cases that I desire this feature for, which is the need for having indexes on the foreign referenced value. $lookup will only allow me to retrieve the field when making the query - it won&apos;t allow me to index on it&lt;/p&gt;

&lt;p&gt;Tricky, yes. I hope in the long term you will consider handling this trickyness in the Mongo Database so that I don&apos;t have to in my application.&lt;/p&gt;</comment>
                            <comment id="969122" author="samk" created="Fri, 17 Jul 2015 21:05:53 +0000"  >&lt;p&gt;Thanks for the request, and overview! There are a lot of complexities around this kind of feature particularly in the context of sharded systems, and all document updates. For these kinds of server-side query operations, the &lt;tt&gt;$lookup&lt;/tt&gt; operation, currently in developmen (see &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-19095&quot; title=&quot;$lookup&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-19095&quot;&gt;&lt;del&gt;SERVER-19095&lt;/del&gt;&lt;/a&gt;,) which will make it possible to produce the kind of output you&apos;re looking for using the Aggregation facility. Many drivers and ODM tools also support these kinds of references, using &lt;a href=&quot;http://docs.mongodb.org/manual/reference/database-references/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;dbRefs&lt;/a&gt;, which makes sense for a large number of applications. Similarly for updating multiple documents, application level &lt;a href=&quot;http://docs.mongodb.org/manual/tutorial/perform-two-phase-commits/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;two-phase-commits&lt;/a&gt; can help you maintain consistency more easily. But you&apos;re right: these sorts of issues are complex and frustrating.&lt;/p&gt;

&lt;p&gt;I hope this makes sense. I&apos;m going to go ahead and close this issue, but if I&apos;ve misunderstood something please feel free to be in touch. &lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
sam&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="11504">SERVER-745</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="212584">SERVER-19095</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="10902">SERVER-432</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 17 Jul 2015 21:05:53 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        8 years, 30 weeks, 5 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>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            8 years, 30 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>genixpro</customfieldvalue>
            <customfieldvalue>sam.kleinman</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrl07b:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hsb9s7:</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_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|hs6ee7:</customfieldvalue>

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