<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39:04 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-1246] Not partially evaluating FieldDefinitions</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1246</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Certain FieldDefinition expressions don&apos;t work, such as &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 index = 1;&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;Builders&amp;lt;Person&amp;gt;.Update.Inc(x =&amp;gt; x..Pets[index].Age, 1);&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;This will break because we have a member binding to a display class as opposed to a constant where index exists. If you are using a constant instead of a variable as an index, then there isn&apos;t a problem.&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Workaround&quot;&gt;&lt;/a&gt;Workaround&lt;/h4&gt;

&lt;p&gt;Instead of using a lambda expression, you can use a string.&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 index = 1;&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 fieldName = string.Format(&quot;Pets.{0}.Age&quot;, index);&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;Builders&amp;lt;Person&amp;gt;.Update.Inc(fieldName, 1);&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;*Note that any members that have been mapped to alternate names will still get mapped. This just lacks refactoring support.&lt;/p&gt;</description>
                <environment></environment>
        <key id="199291">CSHARP-1246</key>
            <summary>Not partially evaluating FieldDefinitions</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="9">Done</resolution>
                                        <assignee username="craig.wilson@mongodb.com">Craig Wilson</assignee>
                                    <reporter username="craig.wilson@mongodb.com">Craig Wilson</reporter>
                        <labels>
                    </labels>
                <created>Tue, 21 Apr 2015 17:38:40 +0000</created>
                <updated>Wed, 20 Jan 2016 20:09:53 +0000</updated>
                            <resolved>Tue, 14 Jul 2015 14:01:49 +0000</resolved>
                                    <version>2.0</version>
                                    <fixVersion>2.0.2</fixVersion>
                    <fixVersion>2.1</fixVersion>
                                    <component>Linq</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="938776" author="xgen-internal-githook" created="Fri, 12 Jun 2015 12:24:45 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;craiggwilson&apos;, u&apos;name&apos;: u&apos;Craig Wilson&apos;, u&apos;email&apos;: u&apos;craiggwilson@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1246&quot; title=&quot;Not partially evaluating FieldDefinitions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1246&quot;&gt;&lt;del&gt;CSHARP-1246&lt;/del&gt;&lt;/a&gt;: fixed issue where expressions including variables were not partially evaluated in a FieldDefinition.&lt;br/&gt;
Branch: v2.0.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/a7ce8588ed80ca2beaad5e0c2b5f71268d69b21c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/a7ce8588ed80ca2beaad5e0c2b5f71268d69b21c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="936967" author="craiggwilson" created="Wed, 10 Jun 2015 21:12:05 +0000"  >&lt;p&gt;Hi Itzhak,&lt;/p&gt;

&lt;p&gt;I think this was mis-marked as being for 2.0.1. It was only pushed to master (which will be 2.1). We&apos;ll consider backporting to 2.0.2. My apologies for the confusion.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="936961" author="itzikkg" created="Wed, 10 Jun 2015 21:04:22 +0000"  >&lt;p&gt;After I took version 2.01 I run this code and got en exception:&lt;/p&gt;

&lt;p&gt;int index = model.Index;&lt;br/&gt;
FilterDefinition&amp;lt;Post&amp;gt; filter = Builders&amp;lt;Post&amp;gt;.Filter.Eq(a =&amp;gt; a.Id, model.PostId);&lt;br/&gt;
UpdateDefinition&amp;lt;Post&amp;gt; update = Builders&amp;lt;Post&amp;gt;.Update.Inc(a =&amp;gt; a.Comments&lt;span class=&quot;error&quot;&gt;&amp;#91;index&amp;#93;&lt;/span&gt;.Likes, 1);&lt;br/&gt;
IMongoCollection&amp;lt;Post&amp;gt; posts = blogContext.Posts;&lt;br/&gt;
try&lt;/p&gt;
            {
                await posts.UpdateOneAsync(filter, update);
            }
&lt;p&gt;            catch (Exception ex)&lt;/p&gt;
            {
                
                // log the exception
            }

&lt;p&gt;The exception is:&lt;br/&gt;
&quot;Unable to determine the serialization information for a =&amp;gt; a.Comments.get_Item(value(M101DotNet.WebApp.Controllers.HomeController+&amp;lt;&amp;gt;c__DisplayClass29).index).Likes.&quot;}	System.Exception {System.InvalidOperationException&lt;/p&gt;</comment>
                            <comment id="895329" author="xgen-internal-githook" created="Wed, 22 Apr 2015 18:48:46 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;craiggwilson&apos;, u&apos;name&apos;: u&apos;Craig Wilson&apos;, u&apos;email&apos;: u&apos;craiggwilson@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1246&quot; title=&quot;Not partially evaluating FieldDefinitions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1246&quot;&gt;&lt;del&gt;CSHARP-1246&lt;/del&gt;&lt;/a&gt;: fixed issue where expressions including variables were not partially evaluated in a FieldDefinition.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/bb61327257408ef3b40d103f4f0f5f182da2b466&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/bb61327257408ef3b40d103f4f0f5f182da2b466&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="210645">CSHARP-1318</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <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|hsa6tb:</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>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="589">C# Sprint 21</customfieldvalue>

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