<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:43:38 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>[CSHARP-2826] MongoDB Collections Join</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2826</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Mongodb collection join using c# driver and LINQ. I found two relevant solutions list below&lt;br/&gt;
&#160;&lt;br/&gt;
{{            var table1 = _myRepo.GetAll();var table2 = table1.Where(x =&amp;gt; x.Type == &quot;MyType&quot;);var try1 = (from x in table1&lt;br/&gt;
                        join y in table2 on new &lt;/p&gt;
{ a = x.ClaimId, b = x.CensusId }
&lt;p&gt; equals                        new &lt;/p&gt;
{ a = y.ClaimId, b = y.CensusId }
&lt;p&gt;select x).ToList();}}&lt;/p&gt;

&lt;p&gt;This query will throw exception&#160;&lt;b&gt;The Join query operator is not supported.&lt;/b&gt;&lt;br/&gt;
&#160;&lt;br/&gt;
{{            var try2 = (from x in table1                        from y in table2                        where x.ClaimId == y.ClaimId &amp;amp;&amp;amp;                        x.CensusId == y.CensusId select x                        ).Select(x =&amp;gt; x).ToList();}}&lt;/p&gt;

&lt;p&gt;This query will throw exception&#160;&lt;b&gt;The SelectMany query operator is not supported&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;But below query works&lt;br/&gt;
&#160;&lt;br/&gt;
{{            var table1 = _arRepository.GetAll();var table2 = table1.Where(x =&amp;gt; x.Type == &quot;MyType&quot;);var claimIds = table2.Select(x =&amp;gt; x.ClaimId).Distinct().ToList();var censusIds = table2.Select(x =&amp;gt; x.CensusId).Distinct().ToList();var data = table1.Where(x =&amp;gt; claimIds.Contains(x.ClaimId) &amp;amp;&amp;amp; censusIds.Contains(x.CensusId));}}&lt;/p&gt;

&lt;p&gt;The problem with this is that it loads the (claimIds and censusIds ) in memory, Actually I want to executes this on server so that it return only required data. I also found a blog for newly mongodb feature (Lookup) discussed in&lt;/p&gt;

&lt;p&gt;Blog:&#160;&lt;a href=&quot;https://www.axonize.com/blog/iot-technology/joining-collections-in-mongodb-using-the-c-driver-and-linq/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://www.axonize.com/blog/iot-technology/joining-collections-in-mongodb-using-the-c-driver-and-linq/&lt;/a&gt;&#160;I flow the blog to install required drivers&lt;br/&gt;
&#160;&lt;br/&gt;
&lt;tt&gt;&amp;lt;PackageReference Include=&quot;mongocsharpdriver&quot; Version=&quot;2.9.2&quot; /&amp;gt;&amp;lt;PackageReference Include=&quot;MongoDB.Bson&quot; Version=&quot;2.9.2&quot; /&amp;gt;&amp;lt;PackageReference Include=&quot;MongoDB.Driver&quot; Version=&quot;2.9.2&quot; /&amp;gt;&amp;lt;PackageReference Include=&quot;MongoDB.Driver.Core&quot; Version=&quot;2.9.2&quot; /&amp;gt;&lt;/tt&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="983567">CSHARP-2826</key>
            <summary>MongoDB Collections Join</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="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="-1">Unassigned</assignee>
                                    <reporter username="farooqawan6581@gmail.com">Farooq Awan</reporter>
                        <labels>
                    </labels>
                <created>Wed, 30 Oct 2019 11:49:26 +0000</created>
                <updated>Thu, 31 Mar 2022 00:26:37 +0000</updated>
                                                                            <component>Linq</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                        <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hvo29z:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>