<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:56:24 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-2128] Accept Documents for setOnInsert</title>
                <link>https://jira.mongodb.org/browse/JAVA-2128</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;&lt;tt&gt;Updates.setOnInsert&lt;/tt&gt; just accepts &lt;tt&gt;(String, TItem)&lt;/tt&gt; as arguments. I think it would be developer friendlier to accept a Document, too.&lt;/p&gt;

&lt;p&gt;Add &lt;tt&gt;Updates.setOnInsert(Bson Items)&lt;/tt&gt; as well for multiple fields that need to be set on insert.&lt;/p&gt;</description>
                <environment></environment>
        <key id="268771">JAVA-2128</key>
            <summary>Accept Documents for setOnInsert</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="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="ChampS">Ben [X]</reporter>
                        <labels>
                    </labels>
                <created>Mon, 29 Feb 2016 16:52:59 +0000</created>
                <updated>Tue, 5 Feb 2019 20:21:00 +0000</updated>
                            <resolved>Wed, 21 Nov 2018 16:34:50 +0000</resolved>
                                    <version>3.2.2</version>
                                    <fixVersion>3.10.0</fixVersion>
                                    <component>Builders</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="2113550" author="xgen-internal-githook" created="Mon, 14 Jan 2019 01:17:29 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;rozza&apos;, &apos;email&apos;: &apos;ross.lawley@gmail.com&apos;, &apos;name&apos;: &apos;Ross Lawley&apos;}
&lt;p&gt;Message: Ensure notNull in Updates.setOnInsert&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2128&quot; title=&quot;Accept Documents for setOnInsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2128&quot;&gt;&lt;del&gt;JAVA-2128&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: 3.10.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/6ae9cd58c16826ac7abb37102d20456c433a3000&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/6ae9cd58c16826ac7abb37102d20456c433a3000&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2113549" author="xgen-internal-githook" created="Mon, 14 Jan 2019 01:17:27 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;rozza&apos;, &apos;email&apos;: &apos;ross.lawley@gmail.com&apos;, &apos;name&apos;: &apos;Ross Lawley&apos;}
&lt;p&gt;Message: Extended Updates.setOnInsert helper.&lt;/p&gt;

&lt;p&gt;It can now take a whole document.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2128&quot; title=&quot;Accept Documents for setOnInsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2128&quot;&gt;&lt;del&gt;JAVA-2128&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: 3.10.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/c12de8e66b9477ce64c56d0a385e5e88a655c0f7&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/c12de8e66b9477ce64c56d0a385e5e88a655c0f7&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2068901" author="xgen-internal-githook" created="Wed, 21 Nov 2018 13:30:19 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Ross Lawley&apos;, &apos;email&apos;: &apos;ross.lawley@gmail.com&apos;, &apos;username&apos;: &apos;rozza&apos;}
&lt;p&gt;Message: Ensure notNull in Updates.setOnInsert&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2128&quot; title=&quot;Accept Documents for setOnInsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2128&quot;&gt;&lt;del&gt;JAVA-2128&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/82f6ca98654204963bf7eeeb8ec0524bdf1e0906&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/82f6ca98654204963bf7eeeb8ec0524bdf1e0906&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2068899" author="xgen-internal-githook" created="Wed, 21 Nov 2018 13:23:07 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Ross Lawley&apos;, &apos;email&apos;: &apos;ross.lawley@gmail.com&apos;, &apos;username&apos;: &apos;rozza&apos;}
&lt;p&gt;Message: Extended Updates.setOnInsert helper.&lt;/p&gt;

&lt;p&gt;It can now take a whole document.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2128&quot; title=&quot;Accept Documents for setOnInsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2128&quot;&gt;&lt;del&gt;JAVA-2128&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/01b94a5128c03a0b014110a674378f23073809cb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/01b94a5128c03a0b014110a674378f23073809cb&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1188867" author="ross@10gen.com" created="Tue, 1 Mar 2016 10:51:58 +0000"  >&lt;p&gt;Thanks for clarifying &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ChampS&quot; class=&quot;user-hover&quot; rel=&quot;ChampS&quot;&gt;ChampS&lt;/a&gt;, sounds like it would be useful!&lt;/p&gt;</comment>
                            <comment id="1188850" author="champs" created="Tue, 1 Mar 2016 10:40:04 +0000"  >&lt;p&gt;Hi Ross and thanks for your quick reply,&lt;/p&gt;

&lt;p&gt;it&apos;s more like your second suggestion. I know I could use &quot;new Document(&quot;$setOnInsert&quot;, myNewDoc)&quot;, but imho it also should work with the setOnInsert method. I think something like &quot;Updates.setOnInsert(myNewDoc)&quot; would be more java like.&lt;/p&gt;

&lt;p&gt;So this bug report is not about solving a problem, but improving the java driver if needed.&lt;/p&gt;

&lt;p&gt;best regards&lt;br/&gt;
Ben&lt;/p&gt;</comment>
                            <comment id="1188125" author="ross@10gen.com" created="Mon, 29 Feb 2016 19:54:52 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ChampS&quot; class=&quot;user-hover&quot; rel=&quot;ChampS&quot;&gt;ChampS&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;The helper already accepts a document as the value for the key to be updated eg: &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;setOnInsert(&apos;subDocument&apos;, new Document(&quot;key&quot;, &quot;value&quot;))&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;Or was it more that you wanted to pass a document of all the keys and values to be set?&lt;br/&gt;
If thats the case then currently you can&apos;t use the helper but its easy to create the whole &lt;tt&gt;$setOnInsert&lt;/tt&gt; document:&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;new Document(&quot;$setOnInsert&quot;, new Document(&quot;key&quot;, &quot;value&quot;).append(&quot;key2&quot;, &quot;value2&quot;))&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;I hope that helps,&lt;/p&gt;

&lt;p&gt;Ross&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|htx9k7:</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>