<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:55:02 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-745] Embedded Document Expansion (Pseudo-JOINs)</title>
                <link>https://jira.mongodb.org/browse/SERVER-745</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Taking a bit of inspiration from CouchDB (&lt;a href=&quot;http://blog.couch.io/post/446015664/whats-new-in-apache-couchdb-0-11-part-two-views&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://blog.couch.io/post/446015664/whats-new-in-apache-couchdb-0-11-part-two-views&lt;/a&gt;) it would be nice for MongoDB to support JOIN-esque operations by using a special &quot;document expander&quot; query command. It is common practice in MongoDB to store partial documents as references, including the DocID and some other attributes useful for displaying that document in the context of the parent document. For instance if I have a document with a &quot;users&quot; key it might contain several users that look like:&lt;/p&gt;

{ &quot;_id&quot;:DocID(&quot;ab2372a4a24&quot;), &quot;name&quot;:&quot;User Name&quot;, &quot;photo&quot;:&quot;http://profile.photo.url&quot;}

&lt;p&gt;Presumably in these cases the embedded document could be considered a &quot;fragment&quot; of the document referenced in the ID. It would, therefore, be extremely useful to be able to automatically &quot;expand&quot; that fragment into the full document when necessary via the query syntax. Let&apos;s say that a &quot;posts&quot; collection has documents with a &quot;users&quot; key containing many fragments as described above. If I perform a query that looks like this:&lt;/p&gt;

&lt;p&gt;db.posts.find().join(&lt;/p&gt;
{&quot;users&quot;:&quot;users&quot;}
&lt;p&gt;)&lt;/p&gt;

&lt;p&gt;Then MongoDB would automatically replace each of the embedded documents in the &quot;users&quot; key with the full document specified in the &quot;users&quot; collection (the document&apos;s key being the key in the join argument, the collection being the value). Additionally, passing a &quot;1&quot; value instead would denote that the values contained in the _id field of the given key are DB References that should be dereferenced individually.&lt;/p&gt;

&lt;p&gt;Note that this should work in the following cases:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Specified key is an array of strings (assume each string represents a DocID) or DocIDs&lt;/li&gt;
	&lt;li&gt;Specified key is an array of embedded documents, each with an _id field&lt;/li&gt;
	&lt;li&gt;Specified key is a single string (assume string is a DocID) or DocID&lt;/li&gt;
	&lt;li&gt;Specified key is a DBRef&lt;/li&gt;
	&lt;li&gt;Specified key is an array of embedded documents, each with an _id field that contains a DBRef&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="11504">SERVER-745</key>
            <summary>Embedded Document Expansion (Pseudo-JOINs)</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="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="mbleigh">Michael Bleigh</reporter>
                        <labels>
                    </labels>
                <created>Sun, 14 Mar 2010 22:47:46 +0000</created>
                <updated>Fri, 17 Jul 2015 20:56:44 +0000</updated>
                            <resolved>Wed, 24 Jun 2015 20:00:20 +0000</resolved>
                                                                    <component>Usability</component>
                                        <votes>18</votes>
                                    <watches>17</watches>
                                                                                                                <comments>
                            <comment id="949760" author="ian@10gen.com" created="Wed, 24 Jun 2015 20:00:20 +0000"  >&lt;p&gt;Hi Michael, thanks a lot for filing this feature request and my apologies for the time since it was last updated.&lt;/p&gt;

&lt;p&gt;I&apos;m going to close this as a Duplicate and link it to our upcoming $lookup feature - after careful consideration we&#8217;ve decided to provide users with the desired functionality via our aggregation pipeline instead of our regular query system.  Please follow along in &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; for further details of the $lookup implementation.&lt;/p&gt;</comment>
                            <comment id="37105" author="wardrop" created="Sat, 11 Jun 2011 02:03:20 +0000"  >&lt;p&gt;@jp &quot;The point where this might really shine, and I have yet to have a full grasp of the internals so not sure of the possibility, would be if the references where some day in the future resolved on the server side. If there were more sophisticated and not just data used to query, rather pointers to addresses of the actual data, then I could see a huge boost here!&quot;&lt;/p&gt;

&lt;p&gt;I believe this is what the reporter was referring to, where MongoDB handles the resolution of DBRef&apos;s server-side. I like the idea a lot myself. It&apos;s only a matter of time until MongoDB gets some kind of server-side document joining capability, but the only question is which method or methods will be used to achieve these joins.&lt;/p&gt;

&lt;p&gt;This idea is good because it proposes that DBRef&apos;s be optionally resolved on the server, while at the same time providing a mechanism to reduce the frequency of the joins by allowing partials to be stored alongside the DBRef&apos;s (kind of as a fallback). I&apos;d like to see this idea merged with &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1632&quot; title=&quot;improve find with using DBRef to support joins&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1632&quot;&gt;&lt;del&gt;SERVER-1632&lt;/del&gt;&lt;/a&gt; to allow querying on DBRef&apos;s also.&lt;/p&gt;

&lt;p&gt;As long as the performance is decent, I think the merger of those ideas would satisfy the majority of use cases for joins in Mongo.&lt;/p&gt;</comment>
                            <comment id="31427" author="jp777" created="Sat, 7 May 2011 01:13:40 +0000"  >&lt;p&gt;I do see this as a potential nicety, but scary when you consider storing your references in an array and having to retrieve them all.  If that bug (&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-142&quot; title=&quot;Read-only views over collection data.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-142&quot;&gt;&lt;del&gt;SERVER-142&lt;/del&gt;&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1797&quot; title=&quot;I need to be able to filter a document down to a single item in a list of items&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1797&quot;&gt;&lt;del&gt;SERVER-1797&lt;/del&gt;&lt;/a&gt;) were resolved then it would be better controlled.&lt;/p&gt;

&lt;p&gt;I do say nicety because it makes life easier in some cases, while mainly you can deal with the subsequent query on the client side just as easy.  The same index search needs to take place as well as the same amount of data across the network.  &lt;/p&gt;

&lt;p&gt;PRO: From a performance standpoint it could reduce some number of round trips which is always good when you are squeezing the most you can.&lt;/p&gt;

&lt;p&gt;The point where this might really shine, and I have yet to have a full grasp of the internals so not sure of the possibility, would be if the references where some day in the future resolved on the server side.  If there were more sophisticated and not just data used to query, rather pointers to addresses of the actual data, then I could see a huge boost here!&lt;/p&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="212584">SERVER-19095</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="217413">SERVER-19476</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="12794">SERVER-1632</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="10902">SERVER-432</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>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sat, 7 May 2011 01:13:40 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        8 years, 34 weeks 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>sam.kleinman</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            8 years, 34 weeks 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>ian@mongodb.com</customfieldvalue>
            <customfieldvalue>jp777</customfieldvalue>
            <customfieldvalue>mbleigh</customfieldvalue>
            <customfieldvalue>wardrop</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpqnj:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6639</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|hrm7pj:</customfieldvalue>

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