<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:37:32 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-681] need a different way to accomplish BsonIgnoreExtraElements</title>
                <link>https://jira.mongodb.org/browse/CSHARP-681</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;If there are documents in Mongo, and the C# driver tries to create them into .NET classes that have &quot;not enough&quot; properties, the c# driver currently throws an exception.  This is a problem in many cases.&lt;/p&gt;

&lt;p&gt;Someone has asked for this before, but was told that this was &quot;by design&quot; and that using the &lt;span class=&quot;error&quot;&gt;&amp;#91;BsonIgnoreExtraElements&amp;#93;&lt;/span&gt; attribute on the .NET class would solve the problem.  It does, BUT.....&lt;/p&gt;

&lt;p&gt;I find this solution to be distasteful in the extreme because it ties the c# object model to Mongo.  The model must have a dependency on the mongo dll that contains the attribute.  This effectively prevents me from being able to use that attribute at all.&lt;/p&gt;

&lt;p&gt;Which means that migrating data is extremely painful when it involves removing properties from the model that have already been saved in Mongo.&lt;/p&gt;

&lt;p&gt;It would be MUCH better, if at the driver level, in the code, I could say something like:&lt;/p&gt;

&lt;p&gt;database.GetCollectionIgnoringExtraElements&lt;br/&gt;
or&lt;br/&gt;
collection.IgnoreExtraElementsWhenDeserializing&lt;br/&gt;
or&lt;br/&gt;
whatever.YouGetTheIdea()&lt;/p&gt;

&lt;p&gt;The whole point being - some way other than by adding a dependency on my model to Mongo, to achieve this goal.  It would make migrations to the model MUCH EASIER.  And would allow us to continue our adoption of Mongo.&lt;/p&gt;</description>
                <environment>any</environment>
        <key id="65302">CSHARP-681</key>
            <summary>need a different way to accomplish BsonIgnoreExtraElements</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="-1">Unassigned</assignee>
                                    <reporter username="travislaborde">Travis Laborde</reporter>
                        <labels>
                    </labels>
                <created>Thu, 14 Feb 2013 17:18:35 +0000</created>
                <updated>Sat, 19 Dec 2020 20:08:20 +0000</updated>
                            <resolved>Thu, 14 Feb 2013 18:19:22 +0000</resolved>
                                    <version>1.7</version>
                                                    <component>Feature Request</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="267045" author="travislaborde" created="Fri, 15 Feb 2013 12:34:15 +0000"  >&lt;p&gt;Awesome - thanks!&lt;/p&gt;</comment>
                            <comment id="266365" author="rstam" created="Thu, 14 Feb 2013 18:18:50 +0000"  >&lt;p&gt;There is already a way to do this that doesn&apos;t require your POCOs to depend on the MongoDB driver.&lt;/p&gt;

&lt;p&gt;Somewhere in your application startup (in a part of the application that does already depend on the MongoDB driver) call this:&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;   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;C&amp;gt;(cm =&amp;gt; { cm.AutoMap(); cm.SetIgnoreExtraElements(true); });&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;For every option you might want to configure, the following document shows how to do it either with attributes or with code:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://docs.mongodb.org/ecosystem/tutorial/serialize-documents-with-the-csharp-driver/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/ecosystem/tutorial/serialize-documents-with-the-csharp-driver/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here&apos;s a quote from that document: &quot;attributes are very convenient to use but for those who prefer to keep serialization details out of their domain classes be assured that anything that can be done with attributes can also be done without them&quot;.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="239458">CSHARP-1478</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </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|hrm653:</customfieldvalue>

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