<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:47:52 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-4317] Linq Provider V3 throws error when accessing dictionary value</title>
                <link>https://jira.mongodb.org/browse/CSHARP-4317</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;h4&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;Summary&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;When storing dictionaries as ArrayOfDocuments (&lt;span class=&quot;error&quot;&gt;&amp;#91;k: 1, v: &amp;quot;v1&amp;quot;}, \{k: 2, v: &amp;quot;v2&amp;quot;}&amp;#93;&lt;/span&gt; and trying to access the values of the dictionary, this works for Linq Provider V2, but version 3 throws an ExpressionNotSupported exception with &quot;Expression not supported: y.Value.&quot;.&lt;/em&gt;&#160;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Pleaseprovidetheversionofthedriver.Ifapplicable%2CpleaseprovidetheMongoDBserverversionandtopology%28standalone%2Creplicaset%2Corshardedcluster%29.&quot;&gt;&lt;/a&gt;Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).&lt;/h4&gt;

&lt;p&gt;C# Driver: 2.17.1&lt;/p&gt;

&lt;p&gt;MongoDB 5.0.9 Community&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;HowtoReproduce&quot;&gt;&lt;/a&gt;How to Reproduce&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Please see attached code file for an extensive sample.&lt;/em&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Code:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; &lt;em&gt;var settings = MongoClientSettings.FromConnectionString(&quot;mongodb://localhost:27017&quot;);&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &lt;em&gt;settings.LinqProvider = prov;&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &lt;em&gt;var client = new MongoClient(settings);&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &lt;em&gt;var db = client.GetDatabase(&quot;test&quot;);&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &lt;em&gt;var coll = db.GetCollection&amp;lt;MyDocument&amp;gt;(&quot;my_collection&quot;);&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &lt;em&gt;var result = coll&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;em&gt;.AsQueryable()&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;em&gt;.Select(x =&amp;gt; new&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;em&gt;{&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;em&gt;Strings = x.DictData.Select(y =&amp;gt; y.Value),&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;em&gt;})&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;em&gt;.ToArray();&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &lt;em&gt;Console.WriteLine($&quot;Works for provider version {prov} (returned items: {result.Length})&quot;);&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &lt;em&gt;foreach (var item in result)&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;em&gt;Console.WriteLine(string.Join(&quot;; &quot;, item.Strings));&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If prov == V2, output is as expected:&lt;/em&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Works for provider version V2 (returned items: 2)&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;Value10; Value11; Value13&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;Value20; Value21; Value23&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If prov == V3, exception is thrown.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;font color=&quot;#1a1a1a&quot;&gt;Additional Background&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The real live example is a more complex linq query with GroupBy statements that build aggregates based on the dictionary values etc. Problem can be circumvented for the moment by using V2, but we want to use V3 whenever possible.&lt;/em&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2132938">CSHARP-4317</key>
            <summary>Linq Provider V3 throws error when accessing dictionary value</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="james.kovacs@mongodb.com">James Kovacs</assignee>
                                    <reporter username="m.wildgruber@sevantage.de">Markus Wildgruber</reporter>
                        <labels>
                    </labels>
                <created>Fri, 9 Sep 2022 14:45:54 +0000</created>
                <updated>Wed, 14 Sep 2022 22:33:07 +0000</updated>
                            <resolved>Wed, 14 Sep 2022 22:11:49 +0000</resolved>
                                    <version>2.17.1</version>
                                                    <component>LINQ3</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4827870" author="xgen-internal-githook" created="Wed, 14 Sep 2022 22:33:07 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;James Kovacs&apos;, &apos;email&apos;: &apos;jkovacs@post.harvard.edu&apos;, &apos;username&apos;: &apos;JamesKovacs&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4317&quot; title=&quot;Linq Provider V3 throws error when accessing dictionary value&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-4317&quot;&gt;&lt;del&gt;CSHARP-4317&lt;/del&gt;&lt;/a&gt;: Added integration test demonstrating that &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4316&quot; title=&quot;LINQ3 incorrect translate for type like as nullable&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-4316&quot;&gt;&lt;del&gt;CSHARP-4316&lt;/del&gt;&lt;/a&gt; fix also resolved dictionary key/value projection issue. (#877)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/f28c86ab88bddfb0581b218f266c121e4461884e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/f28c86ab88bddfb0581b218f266c121e4461884e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4827820" author="james.kovacs" created="Wed, 14 Sep 2022 22:11:49 +0000"  >&lt;p&gt;Resolving &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4316&quot; title=&quot;LINQ3 incorrect translate for type like as nullable&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-4316&quot;&gt;&lt;del&gt;CSHARP-4316&lt;/del&gt;&lt;/a&gt; also resolved this issue. &lt;tt&gt;y.Value&lt;/tt&gt; was being interpreted as the value accessor for a nullable type causing query translation to fail. Interestingly &lt;tt&gt;y.Key&lt;/tt&gt; works even with the 2.17.1 driver correctly translating to &lt;tt&gt;$DictData.k&lt;/tt&gt;.&lt;/p&gt;</comment>
                            <comment id="4816057" author="JIRAUSER1257742" created="Fri, 9 Sep 2022 23:46:27 +0000"  >&lt;p&gt;Thanks &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=m.wildgruber%40sevantage.de&quot; class=&quot;user-hover&quot; rel=&quot;m.wildgruber@sevantage.de&quot;&gt;m.wildgruber@sevantage.de&lt;/a&gt; for reporting this.&lt;br/&gt;
This issue might be related to this ticket &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4316&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/CSHARP-4316&lt;/a&gt;.&lt;br/&gt;
We&apos;ll be looking into this issue, please follow this ticket for further updates.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="2132830">CSHARP-4316</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="400857" name="Program.cs" size="1624" author="m.wildgruber@sevantage.de" created="Fri, 9 Sep 2022 14:42:54 +0000"/>
                            <attachment id="400856" name="my_collection.json" size="489" author="m.wildgruber@sevantage.de" created="Fri, 9 Sep 2022 14:44:50 +0000"/>
                    </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|i0sbns:</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>