<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36: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-432] Linq doesn&apos;t work with derived types when needs to query by string value field</title>
                <link>https://jira.mongodb.org/browse/CSHARP-432</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Got abstract BaseClass and DerivedClass in &quot;collection1&quot;&lt;br/&gt;
Mapping:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;            //BaseClass&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;            BsonClassMap.RegisterClassMap&amp;lt;BaseClass&amp;gt;(cm =&amp;gt;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;            {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;                cm.AutoMap();&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;                cm.MapIdProperty(x =&amp;gt; x.Id);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;                cm.SetIsRootClass(true);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;                cm.GetMemberMap(c =&amp;gt; c.Properties)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;                    .SetSerializationOptions(DictionarySerializationOptions.ArrayOfDocuments);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;            });&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;            BsonClassMap.RegisterClassMap&amp;lt;DerivedClass&amp;gt;();&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var s1 = db.GetCollection(&quot;collection1&quot;).AsQueryable&amp;lt;DerivedClass&amp;gt;().Where(x =&amp;gt; x.Id == &quot;some&quot;).Single(); - don&apos;t work&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var s2 = db.GetCollection(&quot;collection1&quot;).AsQueryable&amp;lt;BaseClass&amp;gt;().Where(x =&amp;gt; x.Id == &quot;some&quot;).Single(); - work&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var s3 = db.GetCollection(&quot;collection1&quot;).AsQueryable&amp;lt;DerivedClass&amp;gt;().Where(x =&amp;gt; x.SomeLogicalField).Single(); - work&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var s4 = db.GetCollection(&quot;collection1&quot;).AsQueryable&amp;lt;DerivedClass&amp;gt;().Where(x =&amp;gt; x.SomeIntegerField &amp;gt; 666).Single(); - work&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Exception: NullReferenceException &quot;Object reference not set to an instance of an object&quot;&lt;br/&gt;
Stack: &lt;br/&gt;
   at MongoDB.Bson.Serialization.BsonClassMapSerializer.GetMemberSerializationInfo(String memberName) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\BsonClassMapSerializer.cs:line 253&lt;br/&gt;
   at MongoDB.Driver.Linq.SelectQuery.GetSerializationInfoMember(IBsonSerializer serializer, MemberExpression memberExpression) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\Translators\SelectQuery.cs:line 962&lt;br/&gt;
   at MongoDB.Driver.Linq.SelectQuery.GetSerializationInfo(IBsonSerializer serializer, Expression expression) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\Translators\SelectQuery.cs:line 888&lt;br/&gt;
   at MongoDB.Driver.Linq.SelectQuery.GetSerializationInfo(Expression expression) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\Translators\SelectQuery.cs:line 880&lt;br/&gt;
   at MongoDB.Driver.Linq.SelectQuery.BuildComparisonQuery(BinaryExpression binaryExpression) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\Translators\SelectQuery.cs:line 433&lt;br/&gt;
   at MongoDB.Driver.Linq.SelectQuery.BuildQuery(Expression expression) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\Translators\SelectQuery.cs:line 768&lt;br/&gt;
   at MongoDB.Driver.Linq.SelectQuery.BuildQuery() in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\Translators\SelectQuery.cs:line 113&lt;br/&gt;
   at MongoDB.Driver.Linq.SelectQuery.Execute() in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\Translators\SelectQuery.cs:line 122&lt;br/&gt;
   at MongoDB.Driver.Linq.MongoQueryProvider.Execute(Expression expression) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\MongoQueryProvider.cs:line 147&lt;br/&gt;
   at MongoDB.Driver.Linq.MongoQueryable`1.GetEnumerator() in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\MongoQueryable.cs:line 81&lt;br/&gt;
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)&lt;br/&gt;
   at System.Linq.Enumerable.ToArray&lt;span class=&quot;error&quot;&gt;&amp;#91;TSource&amp;#93;&lt;/span&gt;(IEnumerable`1 source)&lt;br/&gt;
   at DatabaseMappingTest.Program.Main() in D:\Projects\Support Projects\TestDBSchema\DatabaseMappingTest\Program.cs:line 3380&lt;br/&gt;
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)&lt;br/&gt;
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)&lt;br/&gt;
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()&lt;br/&gt;
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)&lt;br/&gt;
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)&lt;br/&gt;
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)&lt;br/&gt;
   at System.Threading.ThreadHelper.ThreadStart()&lt;/p&gt;</description>
                <environment></environment>
        <key id="35433">CSHARP-432</key>
            <summary>Linq doesn&apos;t work with derived types when needs to query by string value field</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="gfx00">Brian</reporter>
                        <labels>
                    </labels>
                <created>Wed, 4 Apr 2012 05:49:23 +0000</created>
                <updated>Thu, 2 Apr 2015 18:27:46 +0000</updated>
                            <resolved>Wed, 4 Apr 2012 15:35:29 +0000</resolved>
                                    <version>1.4</version>
                                    <fixVersion>1.4.1</fixVersion>
                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="106524" author="rstam" created="Wed, 4 Apr 2012 15:35:07 +0000"  >&lt;p&gt;Thanks for taking another look. I&apos;ll go ahead and mark this as resolved then. This is fixed in the master branch in github so if you&apos;re willing to work with the very latest you will see it fixed.&lt;/p&gt;</comment>
                            <comment id="106401" author="gfx00" created="Wed, 4 Apr 2012 10:10:48 +0000"  >&lt;p&gt;Yep, now I see that this is the same bug - driver doesn&apos;t handle base class properties in derived classes.&lt;/p&gt;</comment>
                            <comment id="106369" author="rstam" created="Wed, 4 Apr 2012 06:41:40 +0000"  >&lt;p&gt;I don&apos;t get a NullReferenceException running your program with the latest version of the driver (master in github).&lt;/p&gt;

&lt;p&gt;The only query you comment as failing is the last. But that query is using the DerivedClass as the type argument to AsQueryable and then querying on an inherited property (x.Id).&lt;/p&gt;

&lt;p&gt;That&apos;s precisely what &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-418&quot; title=&quot;NullReferenceException in LINQ query when querying against inherited field or property&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-418&quot;&gt;&lt;del&gt;CSHARP-418&lt;/del&gt;&lt;/a&gt; was about (doesn&apos;t matter if it&apos;s integer or string, it&apos;s the fact that it was inherited that was triggering the bug).&lt;/p&gt;

&lt;p&gt;This is still looking like a duplicate to me. Let me know what you think. Thanks.&lt;/p&gt;</comment>
                            <comment id="106367" author="rstam" created="Wed, 4 Apr 2012 06:35:30 +0000"  >&lt;p&gt;Thanks. I&apos;ll download your program and try it.&lt;/p&gt;</comment>
                            <comment id="106365" author="gfx00" created="Wed, 4 Apr 2012 06:27:43 +0000"  >&lt;p&gt;Done&lt;/p&gt;</comment>
                            <comment id="106363" author="rstam" created="Wed, 4 Apr 2012 06:08:04 +0000"  >&lt;p&gt;OK. Can you provide the class declarations you used in this test? I&apos;ll work on reproducing then. Thanks.&lt;/p&gt;</comment>
                            <comment id="106362" author="gfx00" created="Wed, 4 Apr 2012 06:03:21 +0000"  >&lt;p&gt;Not the same: there query via interger field - and it&apos;s work properly (s4 in my tests). &lt;br/&gt;
The bug is that driver can&apos;t handle query with string fields&lt;/p&gt;

&lt;p&gt;They are &quot;attached&quot; bugs&lt;/p&gt;</comment>
                            <comment id="106361" author="rstam" created="Wed, 4 Apr 2012 05:58:25 +0000"  >&lt;p&gt;Is this a duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-418&quot; title=&quot;NullReferenceException in LINQ query when querying against inherited field or property&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-418&quot;&gt;&lt;del&gt;CSHARP-418&lt;/del&gt;&lt;/a&gt;? In which case it has already been fixed.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="34864">CSHARP-418</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="15742" name="Program.cs" size="2469" author="gfx00" created="Wed, 4 Apr 2012 06:27:29 +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|hrh7rj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14057</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>