<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:49:49 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-4935] Linq3Implementation unable to handle interface as root</title>
                <link>https://jira.mongodb.org/browse/CSHARP-4935</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 using LinqV3 to translate a linq expression on a mongo collection that has an interface as the generic type. it is unable to translate the query to a mongo query.&lt;/em&gt;&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;Using the latest 2.23.1&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;The following code snippet is enough to reproduce the issue. LinqV2 works as expected.&#160;&lt;/p&gt;


&lt;p&gt;&lt;tt&gt;using MongoDB.Bson;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;using MongoDB.Bson.Serialization;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;using MongoDB.Bson.Serialization.Conventions;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;using MongoDB.Bson.Serialization.Serializers;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;using MongoDB.Driver;&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;public interface IAnimal&lt;/tt&gt;&lt;br/&gt;
{{{}}&lt;br/&gt;
{{public ObjectId Id { get; set; }}}&lt;br/&gt;
{{public int Age { get; set; }}}&lt;br/&gt;
{{public string Name { get; set; }}}&lt;br/&gt;
&lt;tt&gt;}&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;public class Bear : IAnimal&lt;/tt&gt;&lt;br/&gt;
{{{}}&lt;br/&gt;
{{public ObjectId Id { get; set; }}}&lt;br/&gt;
{{public int Age { get; set; }}}&lt;br/&gt;
{{public string Name { get; set; }}}&lt;/p&gt;

&lt;p&gt;{{public bool IsAggressive { get; set; }}}&lt;br/&gt;
&lt;tt&gt;}&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;public class Program&lt;/tt&gt;&lt;br/&gt;
{{{}}&lt;br/&gt;
&lt;tt&gt;public static void Main(params string[] args)&lt;/tt&gt;&lt;br/&gt;
{{{}}&lt;br/&gt;
&lt;tt&gt;BsonSerializer.RegisterSerializer(typeof(object), new ObjectSerializer(t =&amp;gt; true));&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;BsonClassMap.RegisterClassMap&amp;lt;Bear&amp;gt;();&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;BsonSerializer.RegisterDiscriminatorConvention(typeof(IAnimal), new HierarchicalDiscriminatorConvention(&quot;_t&quot;));&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;var settings = new MongoClientSettings()&lt;/tt&gt;&lt;br/&gt;
{{{}}&lt;br/&gt;
&lt;tt&gt;//LinqProvider = LinqProvider.V2&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;};&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;var client = new MongoClient(settings);&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;var collection = client.GetDatabase(&quot;test&quot;).GetCollection&amp;lt;IAnimal&amp;gt;(&quot;animal&quot;);&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;collection.DeleteMany(x =&amp;gt; true);&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;collection.InsertOne(new Bear()&lt;/tt&gt;&lt;br/&gt;
{{{}}&lt;br/&gt;
&lt;tt&gt;Id = ObjectId.GenerateNewId(),&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;Age = 1,&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;Name = &quot;Bob the bear&quot;,&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;IsAggressive = true,&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;});&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;var bears = client.GetDatabase(&quot;test&quot;).GetCollection&amp;lt;IAnimal&amp;gt;(&quot;animal&quot;).Find(x =&amp;gt; x is Bear &amp;amp;&amp;amp; ((Bear)x).IsAggressive).ToList();&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;foreach (var cat in bears)&lt;/tt&gt;&lt;br/&gt;
{{{}}&lt;br/&gt;
{{Console.WriteLine(cat.Name); }}&lt;br/&gt;
&lt;tt&gt;}&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;}&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;}&lt;/tt&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;AdditionalBackground&quot;&gt;&lt;/a&gt;Additional Background&lt;/h4&gt;

&lt;p&gt;I&apos;ve been spending a lot of time trying to make MongoDB work with interface discriminators. This bug is one of the last pieces missing from within the MongoDB driver in order for me to fix this. Additionally I know how to fix it and will create a PR for it.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2549885">CSHARP-4935</key>
            <summary>Linq3Implementation unable to handle interface as root</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</priority>
                        <status id="11262" iconUrl="https://jira.mongodb.org/images/icons/statuses/generic.png" description="">Investigating</status>
                    <statusCategory id="4" key="indeterminate" colorName="inprogress"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="luca@rapidata.ai">Luca Strebel</reporter>
                        <labels>
                    </labels>
                <created>Thu, 18 Jan 2024 14:43:43 +0000</created>
                <updated>Mon, 5 Feb 2024 08:22:44 +0000</updated>
                                                                                                <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="6066449" author="JIRAUSER1276885" created="Mon, 5 Feb 2024 08:22:44 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=robert%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;robert@mongodb.com&quot;&gt;robert@mongodb.com&lt;/a&gt; Can I get an update on this? I&apos;ve provided explanations as well as a PR for this issue. Let me know if I can help with anything&lt;/p&gt;</comment>
                            <comment id="6024232" author="JIRAUSER1276885" created="Thu, 18 Jan 2024 22:40:31 +0000"  >&lt;p&gt;I&apos;ve just submitted a PR that would solve the described issue &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/pull/1250&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/pull/1250&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="6022276" author="dbeng-pm-bot" created="Thu, 18 Jan 2024 14:43:46 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=luca%40rapidata.ai&quot; class=&quot;user-hover&quot; rel=&quot;luca@rapidata.ai&quot;&gt;luca@rapidata.ai&lt;/a&gt;, thank you for reporting this issue! The team will look into it and get back to you soon. &lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="504488" name="Program.cs" size="1651" author="luca@rapidata.ai" created="Thu, 18 Jan 2024 14:44:53 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                        <customfield id="customfield_23812" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Assigned Team</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="26445"><![CDATA[Dotnet Drivers]]></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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i2qm3g:</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>