<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:02:10 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-4475] &apos;Failed to target upsert by query :: could not extract exact shard key&apos;, details={}}.; nested exception is com.mongodb.MongoWriteException:</title>
                <link>https://jira.mongodb.org/browse/JAVA-4475</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Hii,&lt;br/&gt;
We have recently moved to mongo java driver core/sync 4.4.0 from 3.12.1 with spring data mongo db from 2.2.5.RELEASE to 3.3.0 also spring boot version 2.6.2 and mongo server version 4.2.5&lt;/p&gt;

&lt;p&gt;We are getting exceptions while hitting upsert queries on sharded collection with above mentioned error &lt;/p&gt;

&lt;p&gt;There is way to insert shard key in query filter but that is not feasible for us, hence we tried adding @Sharded annotations to our DTO as we have different shard keys for different collections &lt;/p&gt;

&lt;p&gt;Still we are getting the above mentioned error also we are unable to get exact meaning of what is full copy of entity meant in below statement&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;update/upsert&lt;/tt&gt; operations replacing/upserting a single existing document as long as the given &lt;a href=&quot;https://docs.spring.io/spring-data/mongodb/docs/current/api/org/springframework/data/mongodb/core/query/UpdateDefinition.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;UpdateDefinition&lt;/tt&gt;&lt;/a&gt; holds a &lt;b&gt;full copy of the entity&lt;/b&gt;. &lt;/p&gt;

&lt;p&gt;Other queries are working fine also upsert queries are working fine on addition of shard key in query filter but that change is not feasible for us we need quick solution &lt;/p&gt;


&lt;p&gt;Please help as not able to find any solution on any platform. Thanks in advance!&lt;/p&gt;



&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1977413">JAVA-4475</key>
            <summary>&apos;Failed to target upsert by query :: could not extract exact shard key&apos;, details={}}.; nested exception is com.mongodb.MongoWriteException:</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</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="12300">Won&apos;t Do</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="danny@yopmail.com">Danny Pandit</reporter>
                        <labels>
                            <label>external-user</label>
                    </labels>
                <created>Fri, 4 Feb 2022 12:25:02 +0000</created>
                <updated>Wed, 22 Jun 2022 19:06:03 +0000</updated>
                            <resolved>Fri, 4 Feb 2022 18:18:35 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4337631" author="JIRAUSER1269900" created="Sat, 5 Feb 2022 04:09:22 +0000"  >&lt;p&gt;Could you atleast help me with the usage of @Sharded annotation how it can be used to hit upsert on sharded collections.&lt;/p&gt;</comment>
                            <comment id="4336673" author="jeff.yemin" created="Fri, 4 Feb 2022 18:18:07 +0000"  >&lt;p&gt;With the information you&apos;ve provided so far, it&apos;s going to be difficult to make progress.  It&apos;s not clear exactly how to reproduce the issue, and it&apos;s also not clear whether the issue is with the driver, spring data, or the server, since all three were upgraded.  &lt;/p&gt;

&lt;p&gt;I suggest that you create a &lt;a href=&quot;https://stackoverflow.com/help/minimal-reproducible-example&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;minimal reproducible example&lt;/a&gt; that works as expected, then upgrade one component at a time (server, driver, spring data) until it starts to fail, then post all the information to one of these places:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Our MongoDB support portal, located at &lt;a href=&quot;https://support.mongodb.com/welcome&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;support.mongodb.com&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;Our MongoDB community portal, located &lt;a href=&quot;https://developer.mongodb.com/community/forums/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;If you are an Atlas customer, you can review your support options by clicking Support in the top menu bar of the Atlas UI&lt;/li&gt;
&lt;/ul&gt;

</comment>
                            <comment id="4336571" author="JIRAUSER1269900" created="Fri, 4 Feb 2022 17:46:43 +0000"  >&lt;p&gt;Yes. Facing this issue specifically after mongo driver and server upgrade.&lt;/p&gt;

&lt;p&gt;Also even the solution of using @Sharded annotation is not working other solution is to add shard key to query filters is not feasible to us.&lt;/p&gt;</comment>
                            <comment id="4335724" author="jeff.yemin" created="Fri, 4 Feb 2022 13:43:59 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=danny%40yopmail.com&quot; class=&quot;user-hover&quot; rel=&quot;danny@yopmail.com&quot;&gt;danny@yopmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Sorry to hear you are having trouble.  Can you clarify whether you have evidence that the Java driver or Spring Data upgrade is the root cause of the error? i.e. are you saying that everything was working before the upgrade and after the upgrade you are getting the error?  Or is the upgrade unrelated to the error?&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Jeff&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|i0294v:</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>