<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:40 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-385] Add BsonIgnoreIfDefault Attribute</title>
                <link>https://jira.mongodb.org/browse/CSHARP-385</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;We need a BsonIgnoreIfDefault attribute. To work exactly the same as the BsonIgnoreIfNull attribute. I constantly am putting Nullable&amp;lt;&amp;gt; types in my data model to keep rarely used properties out of the database. But on the UI I have to do special magic in a ViewModel to make the type not Nullable. This would be most usefull for Bool Flags that you only care about when they are True. but also usefull for the other built in struct types.&lt;/p&gt;</description>
                <environment>C#</environment>
        <key id="29247">CSHARP-385</key>
            <summary>Add BsonIgnoreIfDefault Attribute</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="middletommy">Thomas Tucker</reporter>
                        <labels>
                            <label>attribute</label>
                    </labels>
                <created>Fri, 27 Jan 2012 13:31:25 +0000</created>
                <updated>Thu, 2 Apr 2015 18:28:21 +0000</updated>
                            <resolved>Tue, 14 Feb 2012 01:34:42 +0000</resolved>
                                    <version>1.3.1</version>
                                    <fixVersion>1.4</fixVersion>
                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="86582" author="rstam" created="Wed, 8 Feb 2012 17:56:05 +0000"  >&lt;p&gt;There is an initial implementation of BsonIgnoreIfDefault in github. This version does NOT deprecate BsonIgnoreIfNull, which can continue to be used with reference classes when all you want to do is ignore nulls.&lt;/p&gt;

&lt;p&gt;An option would be to deprecate BsonIgnoreIfNull, since anything you can do with it you can also do with BsonIgnoreIfDefault (although it requires you to make the small mental leap of realizing that null is just another default value).&lt;/p&gt;

&lt;p&gt;Deprecating BsonIgnoreIfNull would have the downside of breaking backward compatibility.&lt;/p&gt;</comment>
                            <comment id="85939" author="optimiz3" created="Tue, 7 Feb 2012 04:57:34 +0000"  >&lt;p&gt;Also the work around Robert mentions is not fully complete - you will not be able to use it in cases where the default value is not a constant such as DateTime.MinValue. Robert and I have previously discussed this and I&apos;m working on a fix.&lt;/p&gt;</comment>
                            <comment id="83874" author="middletommy" created="Wed, 1 Feb 2012 01:20:35 +0000"  >&lt;p&gt;Thanks for the workaround I didnt know about it. I asked in the forums and was sent here&lt;/p&gt;</comment>
                            <comment id="83863" author="rstam" created="Wed, 1 Feb 2012 00:17:51 +0000"  >&lt;p&gt;That&apos;s not to say we shouldn&apos;t add a BsonIgnoreIfDefault attribute. If you couldn&apos;t find this functionality others probably haven&apos;t either.&lt;/p&gt;

&lt;p&gt;It&apos;s also been suggested that BsonIgnoreIfNull is really just a special case of BsonIgnoreIfDefault for reference classes.&lt;/p&gt;

&lt;p&gt;But if you need an immediate workaround you can use the code above.&lt;/p&gt;</comment>
                            <comment id="83862" author="rstam" created="Wed, 1 Feb 2012 00:13:37 +0000"  >&lt;p&gt;You can already do this, just that it&apos;s part of defining what the default value is. For example:&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;[BsonDefaultValue(false, SerializeDefaultValue = false)]&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;public bool Flag { get; set; }&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;The Flag property will only be serialized if it&apos;s not equal to its default value of false.&lt;/p&gt;

&lt;p&gt;Let me know if this doesn&apos;t meet your needs.&lt;/p&gt;</comment>
                    </comments>
                    <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|hrh81b:</customfieldvalue>

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