<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:02:11 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-4476] Make Java client model classes implement Serializable interface</title>
                <link>https://jira.mongodb.org/browse/JAVA-4476</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;As a Java developer, I would like to make the Java client model classes implement the Serializable interface.&#160;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Motivation&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;I am working on a mongodb connector for the [Apache Flink project|&lt;a href=&quot;https://flink.apache.org/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://flink.apache.org/&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;Internally, Flink is using java serialization to save the records it is working on in a state which in turn used to recover from failures etc, as well as for passing records between different tasks in the pipeline.&lt;br/&gt;
I have noticed the mongodb client model classes are not Serializable for instance, classes such as [WriteModel|&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/master/driver-core/src/main/com/mongodb/client/model/WriteModel.java&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/blob/master/driver-core/src/main/com/mongodb/client/model/WriteModel.java&lt;/a&gt;]&#160;and its subclasses or the different Options like [ReplaceOptions|&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/master/driver-core/src/main/com/mongodb/client/model/ReplaceOptions.java&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/blob/master/driver-core/src/main/com/mongodb/client/model/ReplaceOptions.java&lt;/a&gt;]&#160;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;AC&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Make the Java client model classes implement the Serializable interface.&#160;&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="1978043">JAVA-4476</key>
            <summary>Make Java client model classes implement Serializable interface</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</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="13200">Declined</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="nirtsr@gmail.com">Nir Tsruya</reporter>
                        <labels>
                            <label>external-user</label>
                    </labels>
                <created>Sat, 5 Feb 2022 17:11:19 +0000</created>
                <updated>Fri, 25 Aug 2023 13:31:17 +0000</updated>
                            <resolved>Mon, 14 Feb 2022 15:39:08 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4353529" author="jeff.yemin" created="Mon, 14 Feb 2022 15:39:08 +0000"  >&lt;p&gt;No problem.  Please let us know what you decide to do, and if there&apos;s anything else you need from the driver to enable this integration.&lt;/p&gt;</comment>
                            <comment id="4353507" author="JIRAUSER1264718" created="Mon, 14 Feb 2022 15:30:17 +0000"  >&lt;p&gt;Thank you for the investigation and quick response.&lt;/p&gt;

&lt;p&gt;It makes sense&lt;/p&gt;</comment>
                            <comment id="4340682" author="jeff.yemin" created="Mon, 7 Feb 2022 21:27:00 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=nirtsr%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;nirtsr@gmail.com&quot;&gt;nirtsr@gmail.com&lt;/a&gt;. I see a number of problems with adding this to the driver:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Many of the fields are of type &lt;tt&gt;org.bson.conversions.Bson&lt;/tt&gt;, which does not itself extend &lt;tt&gt;Serializable&lt;/tt&gt;.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;WriteModel&lt;/tt&gt; is generic over &lt;tt&gt;T&lt;/tt&gt;, and there is no requirement that &lt;tt&gt;T&lt;/tt&gt; extends &lt;tt&gt;Serializable&lt;/tt&gt;&lt;/li&gt;
	&lt;li&gt;We often add new fields to the options classes, which would make it difficult to provide guarantees that older versions of those classes could deserialize newer ones&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I think any approach that is taken by Flink has to involve first converting all instances of &lt;tt&gt;org.bson.conversions.Bson&lt;/tt&gt; and of &lt;tt&gt;T&lt;/tt&gt; into a &lt;tt&gt;BsonDocument&lt;/tt&gt;, which &lt;em&gt;does&lt;/em&gt; extend &lt;tt&gt;Serializable&lt;/tt&gt;. But do to that requires knowledge of which &lt;tt&gt;CodecRegistry&lt;/tt&gt; is being using by the application, which &lt;tt&gt;WriteModel&lt;/tt&gt; does not have in isolation (the driver relies on whatever &lt;tt&gt;CodecRegistry&lt;/tt&gt; is configured in the &lt;tt&gt;MongoCollection&lt;/tt&gt; to actually serialize write models).&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|i01wgo:</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>