<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53:42 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-1055] Bad $set update of nested fields fails but throws no error</title>
                <link>https://jira.mongodb.org/browse/JAVA-1055</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Trying to update a nested field of an object that already exists as a value type, will result in an error when executed from the mongo shell:&lt;/p&gt;

&lt;p&gt;&amp;gt; doc = &lt;/p&gt;
{t1:null}
{ &quot;t1&quot; : null }
&lt;p&gt;&amp;gt; db.test.insert(doc)&lt;br/&gt;
&amp;gt; db.test.find()&lt;/p&gt;
{ &quot;_id&quot; : ObjectId(&quot;529c58a9642f618ff689a5eb&quot;), &quot;t1&quot; : null }
&lt;p&gt;&amp;gt; db.test.update(&lt;/p&gt;
{ &quot;_id&quot; : ObjectId(&quot;529c58a9642f618ff689a5eb&quot;)}
&lt;p&gt;,{&quot;$set&quot;:{&quot;t1.t2&quot;:1}})&lt;br/&gt;
LEFT_SUBFIELD only supports Object: t1 not: 10&lt;/p&gt;

&lt;p&gt;Trying the same with the JAVA driver (which I access from MATLAB, but I suppose native JAVA would be similar):&lt;br/&gt;
&amp;gt;&amp;gt; doc(1) = BasicDBObject(&apos;t1&apos;,&apos;&apos;);&lt;br/&gt;
&amp;gt;&amp;gt; db.getCollection(&apos;test&apos;).insert(doc)&lt;br/&gt;
&amp;gt;&amp;gt; db.getCollection(&apos;test&apos;).update(BasicDBObject(&apos;_id&apos;,doc(1).get(&apos;_id&apos;)),BasicDBObject(&apos;$set&apos;,BasicDBObject(&apos;t1.t2&apos;,1)))&lt;/p&gt;

&lt;p&gt;This fails but returns no error (also other valid fields in doc won&apos;t be updated)&lt;/p&gt;</description>
                <environment>Windows and Linux, used through MATLAB</environment>
        <key id="100651">JAVA-1055</key>
            <summary>Bad $set update of nested fields fails but throws no error</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="zoharby">Zohar Bar-Yehuda</reporter>
                        <labels>
                    </labels>
                <created>Mon, 2 Dec 2013 10:17:04 +0000</created>
                <updated>Mon, 2 Dec 2013 15:49:51 +0000</updated>
                            <resolved>Mon, 2 Dec 2013 15:49:51 +0000</resolved>
                                    <version>2.11.3</version>
                                                    <component>Error Handling</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="463965" author="jeff.yemin" created="Mon, 2 Dec 2013 15:49:51 +0000"  >&lt;p&gt;No problem. It is confusing...&lt;/p&gt;</comment>
                            <comment id="463935" author="zoharby" created="Mon, 2 Dec 2013 15:24:45 +0000"  >&lt;p&gt;Yes, it works as expected now. Was using:&lt;br/&gt;
muri = MongoURI(connection_string)&lt;br/&gt;
db = muri.connectDB()&lt;/p&gt;

&lt;p&gt;Changed to MongoClient and now it does return the errors.&lt;br/&gt;
Thanks for the help and sorry for the hassle...&lt;/p&gt;</comment>
                            <comment id="463919" author="jeff.yemin" created="Mon, 2 Dec 2013 15:05:12 +0000"  >&lt;p&gt;Yes, if you use MongoClient instead of Mongo, it will by default report all errors.  Are you saying that it&apos;s not doing that?&lt;/p&gt;</comment>
                            <comment id="463915" author="zoharby" created="Mon, 2 Dec 2013 14:53:08 +0000"  >&lt;p&gt;You&apos;re correct, it&apos;s a write concern issue. The above doesn&apos;t return an error neither (returns N/A in the WriteResult)&lt;br/&gt;
Using this instead:&lt;br/&gt;
db.getCollection(&apos;test&apos;).insert(doc(1),WriteConcern(1))&lt;br/&gt;
does return an error.&lt;/p&gt;

&lt;p&gt;This is what I get:&lt;br/&gt;
m = MongoClient()&lt;/p&gt;

&lt;p&gt;m =&lt;/p&gt;

&lt;p&gt;Mongo{authority=MongoAuthority{type=Direct, serverAddresses=&lt;span class=&quot;error&quot;&gt;&amp;#91;/127.0.0.1:27017&amp;#93;&lt;/span&gt;, credentials={credentials={}}}, options=MongoOptions{description=&apos;null&apos;, connectionsPerHost=100, threadsAllowedToBlockForConnectionMultiplier=5, maxWaitTime=120000, connectTimeout=10000, socketTimeout=0, socketKeepAlive=false, autoConnectRetry=false, maxAutoConnectRetryTime=0, slaveOk=false, readPreference=primary, dbDecoderFactory=DefaultDBDecoder.DefaultFactory, dbEncoderFactory=DefaultDBEncoder.DefaultFactory, safe=false, w=0, wtimeout=0, fsync=false, j=false, socketFactory=javax.net.DefaultSocketFactory@7b58ef06, cursorFinalizerEnabled=true, writeConcern=WriteConcern &lt;/p&gt;
{ &quot;getlasterror&quot; : 1}
&lt;p&gt; / (Continue Inserting on Errors? false), alwaysUseMBeans=false}}&lt;/p&gt;

&lt;p&gt;And also for my object:&lt;br/&gt;
db.getWriteConcern&lt;/p&gt;

&lt;p&gt;ans =&lt;/p&gt;

&lt;p&gt;WriteConcern &lt;/p&gt;
{ &quot;getlasterror&quot; : 1}
&lt;p&gt; / (Continue Inserting on Errors? false)&lt;/p&gt;

&lt;p&gt;Doesn&apos;t this mean it should return the error unless instructed otherwise?&lt;/p&gt;</comment>
                            <comment id="463906" author="jeff.yemin" created="Mon, 2 Dec 2013 14:36:24 +0000"  >&lt;p&gt;It&apos;s possible that MATLAB is using the default write concern from an old version of the Java driver, which is to not check for errors on updates.  &lt;/p&gt;

&lt;p&gt;To check this theory, are you able to get an error reported for any write error?  For example, what happens if you insert the same document twice:&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;&amp;gt;&amp;gt; doc(1) = BasicDBObject(&apos;_id&apos;,1);&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;&amp;gt;&amp;gt; db.getCollection(&apos;test&apos;).insert(doc)&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;&amp;gt;&amp;gt; db.getCollection(&apos;test&apos;).insert(doc)&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;Can you show how the instance of Mongo is created?  Can you try doing it like 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;m = new MongoClient();&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;This will use the correct default write concern, which is WriteConcern.ACKNOWLEDGED. &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|hrujnj:</customfieldvalue>

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