<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:02: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>[JAVA-4669] BSON Ignore in POJO Codec not working as expected on methods</title>
                <link>https://jira.mongodb.org/browse/JAVA-4669</link>
                <project id="10006" key="JAVA">Java 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 codecs with a POJO, any extra methods beginning with the keyword get or set will trigger exceptions, even if the method is marked with the @BsonIgnore annotation.&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;4.6.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;&lt;em&gt;Steps to reproduce. If possible, please include a &lt;a href=&quot;http://sscce.org/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Short, Self Contained, Correct (Compilable), Example&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;public class User {&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &lt;em&gt;@BsonId&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &lt;em&gt;private ObjectId mongoID;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&#160; &#160; &lt;em&gt;@BsonIgnore&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &lt;em&gt;public User setMongoID (String mongoID) {&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &lt;em&gt;this.mongoID = new ObjectId(mongoID);&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &lt;em&gt;return this;&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &lt;em&gt;}&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &lt;em&gt;public User setMongoID (ObjectId mongoID) {&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &lt;em&gt;this.mongoID = mongoID;&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &lt;em&gt;return this;&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &lt;em&gt;}&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &lt;em&gt;public ObjectId getMongoID() {&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; &lt;em&gt;return mongoID;&lt;/em&gt;&lt;br/&gt;
&#160; &#160; &lt;em&gt;}&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;}&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;AdditionalBackground&quot;&gt;&lt;/a&gt;Additional Background&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Please provide any additional background information that may be helpful in diagnosing the bug.&lt;/em&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2083109">JAVA-4669</key>
            <summary>BSON Ignore in POJO Codec not working as expected on methods</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="13202">Works as Designed</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="dennis@nornir.io">Dennis Lee</reporter>
                        <labels>
                    </labels>
                <created>Tue, 5 Jul 2022 19:29:48 +0000</created>
                <updated>Fri, 27 Oct 2023 13:20:52 +0000</updated>
                            <resolved>Thu, 21 Jul 2022 14:11:09 +0000</resolved>
                                    <version>4.6.1</version>
                                                    <component>Codecs</component>
                                        <votes>1</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="4695133" author="ross@10gen.com" created="Thu, 21 Jul 2022 14:49:36 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=dennis%40nornir.io&quot; class=&quot;user-hover&quot; rel=&quot;dennis@nornir.io&quot;&gt;dennis@nornir.io&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Not sure I follow - the exceptions I think you&apos;re seeing is because the POJO has incompatible types for the &lt;tt&gt;mongoID&lt;/tt&gt; property and the PojoCodec doesn&apos;t support overloads for properties.&lt;/p&gt;

&lt;p&gt;It looks like you want to use the &lt;tt&gt;mongoID&lt;/tt&gt; property as the &lt;tt&gt;_id&lt;/tt&gt; as it has a &lt;tt&gt;@bsonId&lt;/tt&gt; annotation. But you also declare you want to ignore the &lt;tt&gt;mongoID&lt;/tt&gt; property because a setter for it has the &lt;tt&gt;@bsonIgnore&lt;/tt&gt; annotation, which isn&apos;t supported (as overloads aren&apos;t supported at this time).  So the work around would be either to: Use the ObjectId constructor and have a single setter, create an alternative setter and ignore that or create a custom codec.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="4695007" author="JIRAUSER1270097" created="Thu, 21 Jul 2022 14:23:55 +0000"  >&lt;p&gt;Hi Ross,&lt;/p&gt;

&lt;p&gt;Wait, so the solution to being able to have more get and set methods in the POJO is to fill it with unused junk variables?&lt;/p&gt;</comment>
                            <comment id="4694952" author="ross@10gen.com" created="Thu, 21 Jul 2022 14:10:58 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=dennis%40nornir.io&quot; class=&quot;user-hover&quot; rel=&quot;dennis@nornir.io&quot;&gt;dennis@nornir.io&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;The annotations such as &lt;tt&gt;BsonIgnore&lt;/tt&gt; are used as part of a conventions and are processed after the initial building of the PropertyModel.  &lt;/p&gt;

&lt;p&gt;Please note: BsonIgnore is used to ignore a whole property - which in the above case would be mapped to &lt;tt&gt;mongoId&lt;/tt&gt;. My suggestions would be to add a new property eg &lt;tt&gt;setMongoIDFromString&lt;/tt&gt; and ignore the alternative property.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=maxsimusi1993%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;maxsimusi1993@gmail.com&quot;&gt;maxsimusi1993@gmail.com&lt;/a&gt; those errors can be related to something else and can often be fixed by explicitly configuring a PojoCodec.&lt;/p&gt;


&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="4694622" author="JIRAUSER1270320" created="Thu, 21 Jul 2022 11:30:54 +0000"  >&lt;p&gt;Can confirm for 4.6.1 and 3.12.11, it usually leads to the exception like:&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;libs.bson.codecs.configuration.CodecConfigurationException:&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;An exception occurred when encoding using the AutomaticPojoCodec.Encoding a RequestEntity: &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&apos;RequestEntity{id=62d9341a1dc99860a2d3f0f6, &amp;lt;REDACTED&amp;gt;}&apos;&lt;/span&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; failed with the following exception:&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;&amp;nbsp;&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;Unable to get value &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;for&lt;/span&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; property &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&apos;rateEntry&apos;&lt;/span&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; in RequestEntity&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;A custom Codec or PojoCodec may need to be explicitly configured and registered to handle &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;this&lt;/span&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; type.&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;at libs.bson.codecs.pojo.AutomaticPojoCodec.encode(AutomaticPojoCodec.java:&lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;53&lt;/span&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;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1978545">JAVA-4479</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|i0jx5k:</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>