<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:13:37 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-7095] Sample of three or more collections</title>
                <link>https://jira.mongodb.org/browse/SERVER-7095</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Hello!&lt;/p&gt;

&lt;p&gt;There are collections&lt;/p&gt;

&lt;p&gt;city: &lt;/p&gt;
{&quot;_id&quot;, &quot;name&quot;}
&lt;p&gt;company: &lt;/p&gt;
{&quot;_id&quot;, &quot;name&quot;, &quot;cityID&quot;}
&lt;p&gt;comments: &lt;/p&gt;
{&quot;_id&quot;, &quot;text&quot;, &quot;companyID&quot;}

&lt;p&gt;You must select the last 10 comments on companies of a certain city.&lt;/p&gt;

&lt;p&gt;Now I select _id first of all companies in the city, and then the 10 comments received on _id&lt;br/&gt;
Here&apos;s the code:&lt;/p&gt;

&lt;p&gt;$ db-&amp;gt; execute (&apos;function () {&lt;/p&gt;

&lt;p&gt;var result = {};&lt;/p&gt;

&lt;p&gt;var company = [];&lt;br/&gt;
result.company = [];&lt;br/&gt;
db.company.find (&lt;/p&gt;
{&quot;city&quot;: &quot;msk&quot;}
&lt;p&gt;, &lt;/p&gt;
{&quot;title&quot;: 1, &quot;_id&quot;: 1}
&lt;p&gt;). forEach (function (a) {&lt;br/&gt;
result.company &lt;span class=&quot;error&quot;&gt;&amp;#91;a._id&amp;#93;&lt;/span&gt; = Object.deepExtend (a, result &lt;span class=&quot;error&quot;&gt;&amp;#91;a._id&amp;#93;&lt;/span&gt;);&lt;br/&gt;
company.push (a._id);&lt;br/&gt;
});&lt;/p&gt;


&lt;p&gt;var comments = [];&lt;br/&gt;
result.comments = [];&lt;br/&gt;
db.comments.find ({&quot;company&quot;: {&quot;$ in&quot;: company}}). sort (&lt;/p&gt;
{&quot;createTime&quot;: -1}
&lt;p&gt;). limit (10). forEach (function (a) &lt;/p&gt;
{
result.comments [a._id] = Object.deepExtend (a, result [a._id]);
comments.push (a._id);
});


return result;

}
&lt;p&gt; &apos;);&lt;/p&gt;

&lt;p&gt;Esti&apos;s a better option to do what I need?&lt;br/&gt;
Thanks in advance for your advice!&lt;/p&gt;</description>
                <environment>PHP driver</environment>
        <key id="51052">SERVER-7095</key>
            <summary>Sample of three or more collections</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</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="sam.helman@10gen.com">sam.helman@10gen.com</assignee>
                                    <reporter username="jeka5555">Evgeny Kalibrov</reporter>
                        <labels>
                    </labels>
                <created>Fri, 21 Sep 2012 11:19:38 +0000</created>
                <updated>Fri, 15 Feb 2013 15:06:18 +0000</updated>
                            <resolved>Fri, 21 Sep 2012 17:25:35 +0000</resolved>
                                                                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="166920" author="jmikola@gmail.com" created="Fri, 21 Sep 2012 21:14:22 +0000"  >&lt;p&gt;I resolved this because the &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;SERVER&lt;/a&gt; project in JIRA is intended to be used for recording issues with the MongoDB server. Your question was a usage question, and a 10gen employee was already responding to your duplicate post of StackOverflow. Please follow up on the question there.&lt;/p&gt;</comment>
                            <comment id="166907" author="jeka5555" created="Fri, 21 Sep 2012 20:51:31 +0000"  >&lt;p&gt;This is the right way to do two queries, where the first we select _id array, and the second looking at the array using &quot;$in&quot;?&lt;/p&gt;</comment>
                            <comment id="166800" author="jmikola@gmail.com" created="Fri, 21 Sep 2012 17:25:06 +0000"  >&lt;p&gt;This is already being answered on SO: &lt;a href=&quot;http://stackoverflow.com/questions/12529663/mongodb-query-from-three-collections&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://stackoverflow.com/questions/12529663/mongodb-query-from-three-collections&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                                        </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>Fri, 21 Sep 2012 17:25:06 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        11 years, 21 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>false</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ian@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            11 years, 21 weeks, 5 days 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>jeka5555</customfieldvalue>
            <customfieldvalue>jmikola@mongodb.com</customfieldvalue>
            <customfieldvalue>sam.helman@10gen.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrno1b:</customfieldvalue>

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

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

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