<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:58: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>[JAVA-2783] InsertOne/InsertMany/ReplaceOne do not accept a BsonValue parameter like updateOne/updateMany does.</title>
                <link>https://jira.mongodb.org/browse/JAVA-2783</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;We started implementing the ORM that came with version 3.x.&lt;/p&gt;

&lt;p&gt;We decorate our Pojos with a custom hash. We now use your ORM to convert the object to BsonDocuments, we then edit it, and then we use it with your MongoCollection.&lt;/p&gt;

&lt;p&gt;I&apos;ve got it all to work, but i&apos;m disappointed that some methods do not accept &apos;raw&apos; bson as a parameter (eg: insertOne and replaceOne).&lt;/p&gt;

&lt;p&gt;I&apos;ve got 2 work-a-rounds for this:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Emulate these methods around with updateOne.&lt;/li&gt;
	&lt;li&gt;Generic the MongoCollection to BsonDocument instead.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I much prefer if MongoCollection supports these method with Bson as a value, as update does.&lt;/p&gt;

&lt;p&gt;For your reference, what I suggest is adding:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;MongoCollection&amp;lt;D&amp;gt;.insertOne(Bson document)&lt;/li&gt;
	&lt;li&gt;MongoCollection&amp;lt;D&amp;gt;.replaceOne(Bson filter, Bson replacement)&lt;br/&gt;
etc.&lt;br/&gt;
Similar to updateOne(Bson filter, Bson update). &lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Looking through the code of MongoCollectionImpl, it seems internally the Pojo is rather quickly converted to Bson.&lt;/p&gt;</description>
                <environment></environment>
        <key id="498502">JAVA-2783</key>
            <summary>InsertOne/InsertMany/ReplaceOne do not accept a BsonValue parameter like updateOne/updateMany does.</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="jessevanhouten">Jesse van Houten</reporter>
                        <labels>
                    </labels>
                <created>Thu, 15 Feb 2018 16:21:54 +0000</created>
                <updated>Wed, 9 Jan 2019 14:54:59 +0000</updated>
                            <resolved>Wed, 9 Jan 2019 14:54:59 +0000</resolved>
                                    <version>3.6.3</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="2109845" author="jeff.yemin" created="Wed, 9 Jan 2019 14:54:59 +0000"  >&lt;p&gt;Closing as Won&apos;t Fix based on the reasons in my previous comment.&lt;/p&gt;</comment>
                            <comment id="2093034" author="jeff.yemin" created="Mon, 17 Dec 2018 17:37:36 +0000"  >&lt;p&gt;From my count, in order to be complete we&apos;d have to overload around 15-20 methods to cover all the cases where T is required.&#160; The MongoCollection interface is already pretty large, so I don&apos;t think this is an acceptable tradeoff given that applications can already use:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;MongoDatabase#getCollection(java.lang.String, java.lang.Class&amp;lt;TDocument&amp;gt;)&lt;/li&gt;
	&lt;li&gt;MongoCollection#withDocumentClass&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;that will accomplish the same thing, albeit at the cost of an extra MongoCollection to track.&lt;/p&gt;

&lt;p&gt;&#160;&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|hthxv3:</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>